1 package test.net.sourceforge.pmd.symboltable; 2 3 import net.sourceforge.pmd.PMD; 4 import net.sourceforge.pmd.ast.ASTClassOrInterfaceDeclaration; 5 import net.sourceforge.pmd.symboltable.ClassScope; 6 import net.sourceforge.pmd.symboltable.MethodNameDeclaration; 7 8 import java.util.Iterator ; 9 import java.util.Map ; 10 11 public class MethodNameDeclarationTest extends STBBaseTst { 12 13 public void testEquality() { 14 parseCode(SIMILAR); 15 ASTClassOrInterfaceDeclaration n = (ASTClassOrInterfaceDeclaration) acu.findChildrenOfType(ASTClassOrInterfaceDeclaration.class).get(0); 16 Map m = ((ClassScope) n.getScope()).getMethodDeclarations(); 17 Iterator i = m.keySet().iterator(); 18 MethodNameDeclaration mnd1 = (MethodNameDeclaration) i.next(); 19 MethodNameDeclaration mnd2 = (MethodNameDeclaration) i.next(); 20 } 21 22 private static final String SIMILAR = 23 "public class Foo {" + PMD.EOL + 24 " public void bar() {" + PMD.EOL + 25 " bar(x, y);" + PMD.EOL + 26 " }" + PMD.EOL + 27 " private void bar(int x, int y) {}" + PMD.EOL + 28 "}"; 29 30 31 } 32 | Popular Tags |