Search in sources :

Example 6 with When

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

the class ManipulationSteps method whenMethodInClassHasItsNameConvertedToUppercase.

@When("method $methodPosition in class $classPosition has it's name converted to uppercase")
public void whenMethodInClassHasItsNameConvertedToUppercase(int methodPosition, int classPosition) {
    CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1");
    MethodDeclaration method = getMethodByPositionAndClassPosition(compilationUnit, methodPosition, classPosition);
    method.setName(method.getNameAsString().toUpperCase());
}
Also used : CompilationUnit(com.github.javaparser.ast.CompilationUnit) MethodDeclaration(com.github.javaparser.ast.body.MethodDeclaration) When(org.jbehave.core.annotations.When)

Example 7 with When

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

the class VisitorSteps method whenTheCompilationUnitIsVisitedByTheVistor.

@When("the CompilationUnit is visited by the to uppercase visitor")
public void whenTheCompilationUnitIsVisitedByTheVistor() {
    CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1");
    toUpperCaseVariableNameVisitor.visit(compilationUnit, null);
    state.put("cu1", compilationUnit);
}
Also used : CompilationUnit(com.github.javaparser.ast.CompilationUnit) When(org.jbehave.core.annotations.When)

Example 8 with When

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

the class VisitorSteps method whenTheCompilationUnitIsVisitedByTheVariableNameCollectorVisitor.

@When("the CompilationUnit is visited by the variable name collector visitor")
public void whenTheCompilationUnitIsVisitedByTheVariableNameCollectorVisitor() {
    CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1");
    collectedVariableName = new AtomicReference<>("");
    collectVariableNameVisitor.visit(compilationUnit, collectedVariableName);
}
Also used : CompilationUnit(com.github.javaparser.ast.CompilationUnit) When(org.jbehave.core.annotations.When)

Example 9 with When

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

the class VisitorSteps method whenTheCompilationUnitIsVisitedByTheVisitorThatReturnsAllVariableNames.

@When("the CompilationUnit is visited by the visitor that returns all variable names")
public void whenTheCompilationUnitIsVisitedByTheVisitorThatReturnsAllVariableNames() {
    CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1");
    returnedVariableNames = allNameReturningVisitor.visit(compilationUnit, null);
}
Also used : CompilationUnit(com.github.javaparser.ast.CompilationUnit) When(org.jbehave.core.annotations.When)

Example 10 with When

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

the class TraderSteps method daysPass.

@When("$days days pass")
public void daysPass(int days) {
    Calendar calendar = Calendar.getInstance();
    calendar.setTime(date);
    calendar.add(Calendar.DAY_OF_YEAR, days);
    date = calendar.getTime();
}
Also used : Calendar(java.util.Calendar) 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