use of net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter in project pmd by pmd.
the class SignatureTest method testGetterDetection.
@Test
public void testGetterDetection() {
ASTCompilationUnit compilationUnit = parseJava17(GetterDetection.class);
compilationUnit.jjtAccept(new JavaParserVisitorAdapter() {
@Override
public Object visit(ASTMethodDeclaration node, Object data) {
assertEquals(Role.GETTER_OR_SETTER, Role.get(node));
return data;
}
}, null);
}
use of net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter in project pmd by pmd.
the class JavaMultifileVisitorTest method testOperationsAreThere.
@Test
public void testOperationsAreThere() {
ASTCompilationUnit acu = parseAndVisitForClass(MultifileVisitorTestData2.class);
final ProjectMirror toplevel = PackageStats.INSTANCE;
final JavaOperationSigMask opMask = new JavaOperationSigMask();
// We could parse qnames from string but probably simpler to do that
acu.jjtAccept(new JavaParserVisitorAdapter() {
@Override
public Object visit(ASTMethodDeclaration node, Object data) {
assertTrue(toplevel.hasMatchingSig(node.getQualifiedName(), opMask));
return data;
}
}, null);
}
use of net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter in project pmd by pmd.
the class SignatureTest method testSetterDetection.
@Test
public void testSetterDetection() {
ASTCompilationUnit compilationUnit = parseJava17(SetterDetection.class);
compilationUnit.jjtAccept(new JavaParserVisitorAdapter() {
@Override
public Object visit(ASTMethodDeclaration node, Object data) {
assertEquals(Role.GETTER_OR_SETTER, Role.get(node));
return data;
}
}, null);
}
Aggregations