1 package test.net.sourceforge.pmd.rules;
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 MethodWithSameNameAsEnclosingClassRuleTest extends SimpleAggregatorTst {
10
11 private Rule rule;
12
13 public void setUp() {
14 rule = new XPathRule();
15 rule.addProperty("xpath", "//UnmodifiedClassDeclaration[@Image = //MethodDeclarator/@Image]");
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 " int Foo(double x) {}" + PMD.EOL +
28 "}";
29
30 private static final String TEST2 =
31 "public class Foo {" + PMD.EOL +
32 " public Foo() {}" + PMD.EOL +
33 "}";
34 }
This page was automatically generated by Maven