KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > net > sourceforge > pmd > symboltable > ScopeCreationVisitorTest


1 /**
2  * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3  */

4 package test.net.sourceforge.pmd.symboltable;
5
6 import net.sourceforge.pmd.PMD;
7 import net.sourceforge.pmd.ast.ASTIfStatement;
8 import net.sourceforge.pmd.symboltable.LocalScope;
9
10 public class ScopeCreationVisitorTest extends STBBaseTst {
11
12     public void testScopesAreCreated() {
13         parseCode(TEST1);
14         ASTIfStatement n = (ASTIfStatement) acu.findChildrenOfType(ASTIfStatement.class).get(0);
15         assertTrue(n.getScope() instanceof LocalScope);
16     }
17
18     private static final String JavaDoc TEST1 =
19             "public class Foo {" + PMD.EOL +
20             " void foo() {" + PMD.EOL +
21             " if (x>2) {}" + PMD.EOL +
22             " }" + PMD.EOL +
23             "}" + PMD.EOL;
24 }
25
Popular Tags