View Javadoc
1 package test.net.sourceforge.pmd.rules.junit; 2 3 import net.sourceforge.pmd.PMD; 4 import net.sourceforge.pmd.rules.junit.JUnitAssertionsShouldIncludeMessageRule; 5 import test.net.sourceforge.pmd.rules.RuleTst; 6 7 public class JUnitAssertionsShouldIncludeMessageRuleTest extends RuleTst { 8 9 public void testAssertEqualsOK() throws Throwable { 10 runTestFromString(TEST1, 0, new JUnitAssertionsShouldIncludeMessageRule()); 11 } 12 public void testAssertEqualsBad() throws Throwable { 13 runTestFromString(TEST2, 1, new JUnitAssertionsShouldIncludeMessageRule()); 14 } 15 public void testAssertTrueOK() throws Throwable { 16 runTestFromString(TEST3, 0, new JUnitAssertionsShouldIncludeMessageRule()); 17 } 18 public void testAssertTrueBad() throws Throwable { 19 runTestFromString(TEST4, 1, new JUnitAssertionsShouldIncludeMessageRule()); 20 } 21 public void testAssertNullOK() throws Throwable { 22 runTestFromString(TEST5, 0, new JUnitAssertionsShouldIncludeMessageRule()); 23 } 24 public void testAssertNullBad() throws Throwable { 25 runTestFromString(TEST6, 1, new JUnitAssertionsShouldIncludeMessageRule()); 26 } 27 public void testAssertSameOK() throws Throwable { 28 runTestFromString(TEST7, 0, new JUnitAssertionsShouldIncludeMessageRule()); 29 } 30 public void testAssertSameBad() throws Throwable { 31 runTestFromString(TEST8, 1, new JUnitAssertionsShouldIncludeMessageRule()); 32 } 33 public void testAssertNotNullOK() throws Throwable { 34 runTestFromString(TEST9, 0, new JUnitAssertionsShouldIncludeMessageRule()); 35 } 36 public void testAssertNotNullBad() throws Throwable { 37 runTestFromString(TEST10, 1, new JUnitAssertionsShouldIncludeMessageRule()); 38 } 39 public void testFindBug() throws Throwable { 40 runTestFromString(TEST11, 0, new JUnitAssertionsShouldIncludeMessageRule()); 41 } 42 43 private static final String TEST1 = 44 "public class JUnitAssertionsShouldIncludeMessageRule1 {" + PMD.EOL + 45 " public void test1() {" + PMD.EOL + 46 " assertEquals(\"1 == 1\", 1, 1);" + PMD.EOL + 47 " }" + PMD.EOL + 48 "}"; 49 50 private static final String TEST2 = 51 "public class JUnitAssertionsShouldIncludeMessageRule2 {" + PMD.EOL + 52 " public void test1() {" + PMD.EOL + 53 " assertEquals(1, 1);" + PMD.EOL + 54 " }" + PMD.EOL + 55 "}"; 56 57 private static final String TEST3 = 58 "public class JUnitAssertionsShouldIncludeMessageRule3 {" + PMD.EOL + 59 " public void test1() {" + PMD.EOL + 60 " assertTrue(\"foo\", \"foo\".equals(\"foo\"));" + PMD.EOL + 61 " }" + PMD.EOL + 62 "}"; 63 64 private static final String TEST4 = 65 "public class JUnitAssertionsShouldIncludeMessageRule4 {" + PMD.EOL + 66 " public void test1() {" + PMD.EOL + 67 " assertTrue(\"foo\".equals(\"foo\"));" + PMD.EOL + 68 " }" + PMD.EOL + 69 "}"; 70 71 private static final String TEST5 = 72 "public class JUnitAssertionsShouldIncludeMessageRule5 {" + PMD.EOL + 73 " public void test1() {" + PMD.EOL + 74 " assertNull(\"it's not null\", null);" + PMD.EOL + 75 " }" + PMD.EOL + 76 "}"; 77 78 private static final String TEST6 = 79 "public class JUnitAssertionsShouldIncludeMessageRule6 {" + PMD.EOL + 80 " public void test1() {" + PMD.EOL + 81 " assertNull(null);" + PMD.EOL + 82 " }" + PMD.EOL + 83 "}"; 84 85 private static final String TEST7 = 86 "public class JUnitAssertionsShouldIncludeMessageRule7 {" + PMD.EOL + 87 " public void test1() {" + PMD.EOL + 88 " assertSame(\"not same!\", null, null);" + PMD.EOL + 89 " }" + PMD.EOL + 90 "}"; 91 92 private static final String TEST8 = 93 "public class JUnitAssertionsShouldIncludeMessageRule8 {" + PMD.EOL + 94 " public void test1() {" + PMD.EOL + 95 " assertSame(null, null);" + PMD.EOL + 96 " }" + PMD.EOL + 97 "}"; 98 99 private static final String TEST9 = 100 "public class JUnitAssertionsShouldIncludeMessageRule9 {" + PMD.EOL + 101 " public void test1() {" + PMD.EOL + 102 " assertNotNull(\"foo\", null);" + PMD.EOL + 103 " }" + PMD.EOL + 104 "}"; 105 106 private static final String TEST10 = 107 "public class JUnitAssertionsShouldIncludeMessageRule10 {" + PMD.EOL + 108 " public void test1() {" + PMD.EOL + 109 " assertNotNull(null);" + PMD.EOL + 110 " }" + PMD.EOL + 111 "}"; 112 113 private static final String TEST11 = 114 "public class JUnitAssertionsShouldIncludeMessageRule11 {" + PMD.EOL + 115 " public void test1() {" + PMD.EOL + 116 " this.test1(\"foo\");" + PMD.EOL + 117 " }" + PMD.EOL + 118 "}"; 119 120 }

This page was automatically generated by Maven