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