View Javadoc
1 package test.net.sourceforge.pmd.rules.junit; 2 3 import net.sourceforge.pmd.PMD; 4 import net.sourceforge.pmd.Rule; 5 import net.sourceforge.pmd.rules.XPathRule; 6 import test.net.sourceforge.pmd.rules.RuleTst; 7 8 public class JUnitStaticSuiteRuleTest extends RuleTst { 9 10 private static final String TEST1 = 11 "public class JUnitStaticSuite1 {" + PMD.EOL + 12 " public TestSuite suite() {}" + PMD.EOL + 13 "}"; 14 15 private static final String TEST2 = 16 "public class JUnitStaticSuite2 {" + PMD.EOL + 17 " public static TestSuite suite() {}" + PMD.EOL + 18 "}"; 19 20 private static final String TEST3 = 21 "public class JUnitStaticSuite3 {" + PMD.EOL + 22 " private static TestSuite suite() {}" + PMD.EOL + 23 "}"; 24 25 private Rule rule; 26 27 public void setUp() { 28 rule = new XPathRule(); 29 rule.addProperty("xpath", "//MethodDeclaration[not(@Static='true') or not(@Public='true')][MethodDeclarator/@Image='suite']"); 30 } 31 public void testNonstatic() throws Throwable { 32 runTestFromString(TEST1, 1, rule); 33 } 34 public void testGoodOK() throws Throwable { 35 runTestFromString(TEST2, 0, rule); 36 } 37 public void testPrivateSuite() throws Throwable { 38 runTestFromString(TEST3, 1, rule); 39 } 40 }

This page was automatically generated by Maven