View Javadoc
1 package test.net.sourceforge.pmd.rules.strictexception; 2 3 import net.sourceforge.pmd.PMD; 4 import net.sourceforge.pmd.rules.strictexception.AvoidCatchingThrowable; 5 import test.net.sourceforge.pmd.rules.SimpleAggregatorTst; 6 import test.net.sourceforge.pmd.rules.TestDescriptor; 7 8 public class AvoidCatchingThrowableRuleTest extends SimpleAggregatorTst { 9 10 public void testAll() { 11 runTests(new TestDescriptor[] { 12 new TestDescriptor(TEST1, "simple failure case", 1, new AvoidCatchingThrowable()), 13 new TestDescriptor(TEST2, "ok", 0, new AvoidCatchingThrowable()), 14 }); 15 } 16 17 private static final String TEST1 = 18 "public class Foo {" + PMD.EOL + 19 " void foo() {" + PMD.EOL + 20 " try {} catch (Throwable t) {} " + PMD.EOL + 21 " }" + PMD.EOL + 22 "}"; 23 24 private static final String TEST2 = 25 "public class Foo {" + PMD.EOL + 26 " void foo() {" + PMD.EOL + 27 " try {} catch (RuntimeException t) {} " + PMD.EOL + 28 " }" + PMD.EOL + 29 "}"; 30 }

This page was automatically generated by Maven