View Javadoc

    1   package net.sourceforge.pmd.lang.java.rule.strictexception;
    2
    3   import net.sourceforge.pmd.testframework.SimpleAggregatorTst;
    4
    5   import org.junit.Before;
    6
    7
    8   public class StrictExceptionRulesTest extends SimpleAggregatorTst {
    9
    10      private static final String RULESET = "java-strictexception";
    11
    12      @Before
    13      public void setUp() {
    14          addRule(RULESET, "AvoidCatchingGenericException");
    15          addRule(RULESET, "AvoidCatchingNPE");
    16          addRule(RULESET, "AvoidCatchingThrowable");
    17          addRule(RULESET, "AvoidLosingExceptionInformation");
    18          addRule(RULESET, "AvoidRethrowingException");
    19          addRule(RULESET, "AvoidThrowingNewInstanceOfSameException");
    20          addRule(RULESET, "AvoidThrowingNullPointerException");
    21          addRule(RULESET, "AvoidThrowingRawExceptionTypes");
    22          addRule(RULESET, "DoNotExtendJavaLangError");
    23          addRule(RULESET, "ExceptionAsFlowControl");
    24          addRule(RULESET, "SignatureDeclareThrowsException");
    25          addRule(RULESET, "DoNotThrowExceptionInFinally");
    26      }
    27
    28      public static junit.framework.Test suite() {
    29          return new junit.framework.JUnit4TestAdapter(StrictExceptionRulesTest.class);
    30      }
    31  }