use of com.github.javaparser.ast.CompilationUnit in project javaparser by javaparser.
the class ManipulationSteps method thenMethodInClassHasTheName.
@Then("method $methodPosition in class $classPosition has the name \"$expectedName\"")
public void thenMethodInClassHasTheName(int methodPosition, int classPosition, String expectedName) {
CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1");
MethodDeclaration method = getMethodByPositionAndClassPosition(compilationUnit, methodPosition, classPosition);
assertThat(method.getNameAsString(), is(expectedName));
}
use of com.github.javaparser.ast.CompilationUnit 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());
}
use of com.github.javaparser.ast.CompilationUnit in project javaparser by javaparser.
the class ManipulationSteps method thenIsNotEqualToNull.
@Then("is not equal to null")
public void thenIsNotEqualToNull() {
CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1");
assertNotEquals(compilationUnit, null);
}
use of com.github.javaparser.ast.CompilationUnit in project javaparser by javaparser.
the class ParsingSteps method thenMethodClassIsNotADefaultMethod.
@Then("method $methodPosition class $classPosition is not a default method")
public void thenMethodClassIsNotADefaultMethod(int methodPosition, int classPosition) {
CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1");
MethodDeclaration methodUnderTest = getMethodByPositionAndClassPosition(compilationUnit, methodPosition, classPosition);
assertThat(methodUnderTest.isDefault(), is(false));
}
use of com.github.javaparser.ast.CompilationUnit in project javaparser by javaparser.
the class ParsingSteps method getStatementInMethodInClass.
private Statement getStatementInMethodInClass(int statementPosition, int methodPosition, int classPosition) {
CompilationUnit compilationUnit = (CompilationUnit) state.get("cu1");
MethodDeclaration method = getMethodByPositionAndClassPosition(compilationUnit, methodPosition, classPosition);
return method.getBody().get().getStatement(statementPosition - 1);
}
Aggregations