1 /** 2 * BSD-style license; for more info see http://pmd.sourceforge.net/license.html 3 */ 4 package test.net.sourceforge.pmd.rules.basic; 5 6 import net.sourceforge.pmd.PMD; 7 import net.sourceforge.pmd.Rule; 8 9 import org.junit.Before; 10 import org.junit.Ignore; 11 import org.junit.Test; 12 13 import test.net.sourceforge.pmd.testframework.SimpleAggregatorTst; 14 import test.net.sourceforge.pmd.testframework.TestDescriptor; 15 16 public class UnusedNullCheckInEqualsTest extends SimpleAggregatorTst { 17 private Rule rule; 18 19 @Before 20 public void setUp() { 21 rule = findRule("basic", "UnusedNullCheckInEquals"); 22 } 23 24 @Test 25 public void testAll() { 26 runTests(rule); 27 } 28 29 @Ignore 30 @Test 31 public void testN(){ 32 runTest(new TestDescriptor(TESTN, "shouldn't this fail?", 1, rule)); 33 } 34 35 private static final String TESTN = 36 "public class Foo {" + PMD.EOL + 37 " public void bar() {" + PMD.EOL + 38 " if (x != null && y.equals(x)) {} " + PMD.EOL + 39 " }" + PMD.EOL + 40 "}"; 41 42 43 public static junit.framework.Test suite() { 44 return new junit.framework.JUnit4TestAdapter(UnusedNullCheckInEqualsTest.class); 45 } 46 }