1 package test.net.sourceforge.pmd.ast; 2 3 import net.sourceforge.pmd.PMD; 4 import net.sourceforge.pmd.ast.ASTPrimarySuffix; 5 import test.net.sourceforge.pmd.testframework.ParserTst; 6 7 import java.util.Set; 8 9 public class ASTPrimarySuffixTest extends ParserTst { 10 11 public void testArrayDereference() throws Throwable { 12 Set ops = getNodes(ASTPrimarySuffix.class, TEST1); 13 assertTrue(((ASTPrimarySuffix) (ops.iterator().next())).isArrayDereference()); 14 } 15 16 public void testArguments() throws Throwable { 17 Set ops = getNodes(ASTPrimarySuffix.class, TEST2); 18 assertTrue(((ASTPrimarySuffix) (ops.iterator().next())).isArguments()); 19 } 20 21 private static final String TEST1 = 22 "public class Foo {" + PMD.EOL + 23 " {x[0] = 2;}" + PMD.EOL + 24 "}"; 25 26 private static final String TEST2 = 27 "public class Foo {" + PMD.EOL + 28 " {foo(a);}" + PMD.EOL + 29 "}"; 30 31 32 }