01: package test.net.sourceforge.pmd.rules.basic;
02:
03: import net.sourceforge.pmd.PMD;
04: import net.sourceforge.pmd.Rule;
05:
06: import org.junit.Before;
07: import org.junit.Ignore;
08: import org.junit.Test;
09:
10: import test.net.sourceforge.pmd.testframework.SimpleAggregatorTst;
11: import test.net.sourceforge.pmd.testframework.TestDescriptor;
12:
13: public class UnusedNullCheckInEqualsTest extends SimpleAggregatorTst {
14: private Rule rule;
15:
16: @Before
17: public void setUp() {
18: rule = findRule("basic", "UnusedNullCheckInEquals");
19: }
20:
21: @Test
22: public void testAll() {
23: runTests(rule);
24: }
25:
26: @Ignore
27: @Test
28: public void testN() {
29: runTest(new TestDescriptor(TESTN, "shouldn't this fail?", 1,
30: rule));
31: }
32:
33: private static final String TESTN = "public class Foo {" + PMD.EOL
34: + " public void bar() {" + PMD.EOL
35: + " if (x != null && y.equals(x)) {} " + PMD.EOL + " }"
36: + PMD.EOL + "}";
37:
38: public static junit.framework.Test suite() {
39: return new junit.framework.JUnit4TestAdapter(
40: UnusedNullCheckInEqualsTest.class);
41: }
42: }
|