    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;
    8
    9   public class ASTBooleanLiteralTest extends ParserTst {
    10
    11      public void testTrue() throws Throwable {
    12          Set ops = getNodes(ASTBooleanLiteral.class, TEST1);
    13          ASTBooleanLiteral b = (ASTBooleanLiteral) ops.iterator().next();
    14          assertTrue(b.isTrue());
    15      }
    16
    17      public void testFalse() throws Throwable {
    18          Set ops = getNodes(ASTBooleanLiteral.class, TEST2);
    19          ASTBooleanLiteral b = (ASTBooleanLiteral) ops.iterator().next();
    20          assertTrue(!b.isTrue());
    21      }
    22
    23      private static final String TEST1 =
    24              "class Foo { " + PMD.EOL +
    25              " boolean bar = true; " + PMD.EOL +
    26              "} ";
    27
    28      private static final String TEST2 =
    29              "class Foo { " + PMD.EOL +
    30              " boolean bar = false; " + PMD.EOL +
    31              "} ";
    32
    33  }