View Javadoc

    1   package net.sourceforge.pmd.ast;
    2
    3   import static org.junit.Assert.assertFalse;
    4   import static org.junit.Assert.assertTrue;
    5   import net.sourceforge.pmd.lang.java.ast.ASTAllocationExpression;
    6   import net.sourceforge.pmd.lang.java.ast.ASTAssertStatement;
    7   import net.sourceforge.pmd.lang.java.ast.ASTBlockStatement;
    8   import net.sourceforge.pmd.testframework.ParserTst;
    9
    10  import org.junit.Test;
    11
    12
    13  public class ASTBlockStatementTest extends ParserTst {
    14
    15      @Test
    16      public void testIsAllocation() {
    17          ASTBlockStatement bs = new ASTBlockStatement(0);
    18          bs.jjtAddChild(new ASTAllocationExpression(1), 0);
    19          assertTrue(bs.isAllocation());
    20      }
    21
    22      @Test
    23      public void testIsAllocation2() {
    24          ASTBlockStatement bs = new ASTBlockStatement(0);
    25          bs.jjtAddChild(new ASTAssertStatement(1), 0);
    26          assertFalse(bs.isAllocation());
    27      }
    28
    29      public static junit.framework.Test suite() {
    30          return new junit.framework.JUnit4TestAdapter(ASTBlockStatementTest.class);
    31      }
    32  }