Search in sources :

Example 16 with When

use of org.jbehave.core.annotations.When in project javaparser by javaparser.

the class CommentParsingSteps method whenTheClassIsParsedByTheJavaParser.

@When("the class is parsed by the Java parser")
public void whenTheClassIsParsedByTheJavaParser() {
    ParseResult<CompilationUnit> result = new JavaParser(configuration).parse(COMPILATION_UNIT, provider(sourceUnderTest));
    compilationUnit = result.getResult().get();
}
Also used : CompilationUnit(com.github.javaparser.ast.CompilationUnit) JavaParser(com.github.javaparser.JavaParser) When(org.jbehave.core.annotations.When)

Example 17 with When

use of org.jbehave.core.annotations.When in project javaparser by javaparser.

the class CommentParsingSteps method whenTheClassIsParsedByTheCommentParser.

@When("the class is parsed by the comment parser")
public void whenTheClassIsParsedByTheCommentParser() throws IOException {
    ParseResult<CompilationUnit> parseResult = new JavaParser(new ParserConfiguration()).parse(COMPILATION_UNIT, provider(sourceUnderTest));
    commentsCollection = parseResult.getCommentsCollection().orElse(new CommentsCollection());
}
Also used : CompilationUnit(com.github.javaparser.ast.CompilationUnit) JavaParser(com.github.javaparser.JavaParser) ParserConfiguration(com.github.javaparser.ParserConfiguration) When(org.jbehave.core.annotations.When)

Example 18 with When

use of org.jbehave.core.annotations.When in project javaparser by javaparser.

the class ManipulationSteps method whenThePackageDeclarationIsSetTo.

@When("the package declaration is set to \"$packageName\"")
public void whenThePackageDeclarationIsSetTo(String packageName) {
    CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1");
    compilationUnit.setPackageDeclaration(new PackageDeclaration(parseName(packageName)));
    state.put("cu1", compilationUnit);
}
Also used : CompilationUnit(com.github.javaparser.ast.CompilationUnit) PackageDeclaration(com.github.javaparser.ast.PackageDeclaration) When(org.jbehave.core.annotations.When)

Example 19 with When

use of org.jbehave.core.annotations.When in project javaparser by javaparser.

the class ManipulationSteps method whenTheCompilationUnitIsCloned.

@When("the compilation unit is cloned")
public void whenTheCompilationUnitIsCloned() throws CloneNotSupportedException {
    CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1");
    state.put("cu1", compilationUnit.clone());
}
Also used : CompilationUnit(com.github.javaparser.ast.CompilationUnit) When(org.jbehave.core.annotations.When)

Example 20 with When

use of org.jbehave.core.annotations.When in project javaparser by javaparser.

the class ManipulationSteps method whenABlockStmtIsAddedToMethodInClass.

@When("a BlockStmt is added to method $methodPosition in class $classPosition")
public void whenABlockStmtIsAddedToMethodInClass(int methodPosition, int classPosition) {
    CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1");
    MethodDeclaration method = getMethodByPositionAndClassPosition(compilationUnit, methodPosition, classPosition);
    method.setBody(new BlockStmt());
}
Also used : CompilationUnit(com.github.javaparser.ast.CompilationUnit) MethodDeclaration(com.github.javaparser.ast.body.MethodDeclaration) BlockStmt(com.github.javaparser.ast.stmt.BlockStmt) When(org.jbehave.core.annotations.When)

Aggregations

When (org.jbehave.core.annotations.When)30 CompilationUnit (com.github.javaparser.ast.CompilationUnit)21 MethodDeclaration (com.github.javaparser.ast.body.MethodDeclaration)5 JavaParser (com.github.javaparser.JavaParser)3 ParserConfiguration (com.github.javaparser.ParserConfiguration)2 File (java.io.File)2 Resource (org.jbehave.core.io.rest.Resource)2 Modifier (com.github.javaparser.ast.Modifier)1 PackageDeclaration (com.github.javaparser.ast.PackageDeclaration)1 ClassOrInterfaceDeclaration (com.github.javaparser.ast.body.ClassOrInterfaceDeclaration)1 BlockStmt (com.github.javaparser.ast.stmt.BlockStmt)1 VoidType (com.github.javaparser.ast.type.VoidType)1 CloneVisitor (com.github.javaparser.ast.visitor.CloneVisitor)1 FileWriter (java.io.FileWriter)1 IOException (java.io.IOException)1 Method (java.lang.reflect.Method)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 Calendar (java.util.Calendar)1 HttpResponse (org.apache.http.HttpResponse)1