01: package test.net.sourceforge.pmd.symboltable;
02:
03: import net.sourceforge.pmd.PMD;
04: import net.sourceforge.pmd.ast.ASTClassOrInterfaceDeclaration;
05: import net.sourceforge.pmd.symboltable.ClassScope;
06: import net.sourceforge.pmd.symboltable.MethodNameDeclaration;
07: import net.sourceforge.pmd.symboltable.NameOccurrence;
08:
09: import org.junit.Test;
10:
11: import java.util.Iterator;
12: import java.util.List;
13: import java.util.Map;
14:
15: public class MethodNameDeclarationTest extends STBBaseTst {
16:
17: @Test
18: public void testEquality() {
19: //FIXME does this test DO anything?
20: parseCode(SIMILAR);
21: ASTClassOrInterfaceDeclaration n = acu.findChildrenOfType(
22: ASTClassOrInterfaceDeclaration.class).get(0);
23: Map<MethodNameDeclaration, List<NameOccurrence>> m = ((ClassScope) n
24: .getScope()).getMethodDeclarations();
25: Iterator<MethodNameDeclaration> i = m.keySet().iterator();
26: MethodNameDeclaration mnd1 = i.next();
27: MethodNameDeclaration mnd2 = i.next();
28: }
29:
30: private static final String SIMILAR = "public class Foo {"
31: + PMD.EOL + " public void bar() {" + PMD.EOL
32: + " bar(x, y);" + PMD.EOL + " }" + PMD.EOL
33: + " private void bar(int x, int y) {}" + PMD.EOL + "}";
34:
35: public static junit.framework.Test suite() {
36: return new junit.framework.JUnit4TestAdapter(
37: MethodNameDeclarationTest.class);
38: }
39: }
|