1 package test.net.sourceforge.pmd.rules;
2
3 import net.sourceforge.pmd.PMD;
4 import net.sourceforge.pmd.rules.IdempotentOperationsRule;
5
6 public class IdempotentOperationsRuleTest extends SimpleAggregatorTst {
7
8 public void testAll() {
9 runTests(new TestDescriptor[] {
10 new TestDescriptor(TEST1, "assignment of a local to itself", 1, new IdempotentOperationsRule()),
11 // FIXME
12 new TestDescriptor(TEST2, "assignment of one array element to another ", 1, new IdempotentOperationsRule())
13 });
14 }
15
16 private static final String TEST1 =
17 "public class Foo {" + PMD.EOL +
18 " private void bar() { " + PMD.EOL +
19 " int x = 2;" + PMD.EOL +
20 " x = x;" + PMD.EOL +
21 " }" + PMD.EOL +
22 "}";
23
24 private static final String TEST2 =
25 "public class Foo {" + PMD.EOL +
26 " private void bar() { " + PMD.EOL +
27 " int[] x = {2,3};" + PMD.EOL +
28 " x[0] = x[1];" + PMD.EOL +
29 " }" + PMD.EOL +
30 "}";
31
32 }
This page was automatically generated by Maven