View Javadoc
1 package test.net.sourceforge.pmd.rules.finalize; 2 3 import test.net.sourceforge.pmd.testframework.SimpleAggregatorTst; 4 import test.net.sourceforge.pmd.testframework.TestDescriptor; 5 import net.sourceforge.pmd.Rule; 6 import net.sourceforge.pmd.PMD; 7 import net.sourceforge.pmd.rules.XPathRule; 8 9 public class FinalizeOverloadedRuleTest extends SimpleAggregatorTst { 10 11 private Rule rule; 12 13 public void setUp() { 14 rule = new XPathRule(); 15 rule.addProperty("xpath", "//MethodDeclaration[MethodDeclarator[@Image='finalize'][FormalParameters/*]]"); 16 } 17 18 public void testAll() { 19 runTests(new TestDescriptor[] { 20 new TestDescriptor(TEST1, "bad", 1, rule), 21 new TestDescriptor(TEST2, "ok", 0, rule), 22 }); 23 } 24 25 private static final String TEST1 = 26 "public class Foo {" + PMD.EOL + 27 " public void finalize(int foo) {}" + PMD.EOL + 28 "}"; 29 30 private static final String TEST2 = 31 "public class Foo {" + PMD.EOL + 32 " public void finalize() {" + PMD.EOL + 33 " doSomething();" + PMD.EOL + 34 " }" + PMD.EOL + 35 "}"; 36 }

This page was automatically generated by Maven