KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > net > sourceforge > pmd > ast > ASTBooleanLiteralTest


1 package test.net.sourceforge.pmd.ast;
2
3 import net.sourceforge.pmd.PMD;
4 import net.sourceforge.pmd.ast.ASTBooleanLiteral;
5 import test.net.sourceforge.pmd.testframework.ParserTst;
6
7 import java.util.Set JavaDoc;
8
9 public class ASTBooleanLiteralTest extends ParserTst {
10
11     public void testTrue() throws Throwable JavaDoc {
12         Set JavaDoc ops = getNodes(ASTBooleanLiteral.class, TEST1);
13         ASTBooleanLiteral b = (ASTBooleanLiteral) ops.iterator().next();
14         assertTrue(b.isTrue());
15     }
16
17     public void testFalse() throws Throwable JavaDoc {
18         Set JavaDoc ops = getNodes(ASTBooleanLiteral.class, TEST2);
19         ASTBooleanLiteral b = (ASTBooleanLiteral) ops.iterator().next();
20         assertTrue(!b.isTrue());
21     }
22
23     private static final String JavaDoc TEST1 =
24             "class Foo { " + PMD.EOL +
25             " boolean bar = true; " + PMD.EOL +
26             "} ";
27
28     private static final String JavaDoc TEST2 =
29             "class Foo { " + PMD.EOL +
30             " boolean bar = false; " + PMD.EOL +
31             "} ";
32
33 }
34
Popular Tags