View Javadoc
1 package test.net.sourceforge.pmd.rules; 2 3 import net.sourceforge.pmd.PMD; 4 import net.sourceforge.pmd.Rule; 5 import net.sourceforge.pmd.rules.XPathRule; 6 7 public class EmptyWhileStmtRuleTest extends SimpleAggregatorTst { 8 9 private Rule rule; 10 11 public void setUp() { 12 rule = new XPathRule(); 13 rule.addProperty("xpath", "//WhileStatement/Statement/Block[count(*) = 0]"); 14 } 15 16 public void testAll() { 17 runTests(new TestDescriptor[] { 18 new TestDescriptor(TEST1, "bad", 1, rule), 19 }); 20 } 21 22 private static final String TEST1 = 23 "public class Foo {" + PMD.EOL + 24 " public void bar() {" + PMD.EOL + 25 " while (true == true) {" + PMD.EOL + 26 " }" + PMD.EOL + 27 " while (true == true) {" + PMD.EOL + 28 " String x = \"\";" + PMD.EOL + 29 " }" + PMD.EOL + 30 " }" + PMD.EOL + 31 "}"; 32 33 }

This page was automatically generated by Maven