View Javadoc

    1   /**
    2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
    3    */
    4   package net.sourceforge.pmd.lang.java.rule.design;
    5
    6   import net.sourceforge.pmd.testframework.SimpleAggregatorTst;
    7
    8   import org.junit.Before;
    9
    10
    11  public class DesignRulesTest extends SimpleAggregatorTst {
    12
    13      private static final String RULESET = "java-design";
    14
    15      @Before
    16      public void setUp() {
    17          addRule(RULESET, "AbstractClassWithoutAbstractMethod");
    18          addRule(RULESET, "AbstractClassWithoutAnyMethod");
    19          addRule(RULESET, "AccessorClassGeneration");
    20          addRule(RULESET, "AssignmentToNonFinalStatic");
    21          addRule(RULESET, "AvoidConstantsInterface");
    22          addRule(RULESET, "AvoidDeeplyNestedIfStmts");
    23          addRule(RULESET, "AvoidInstanceofChecksInCatchClause");
    24          addRule(RULESET, "AvoidProtectedFieldInFinalClass");
    25          addRule(RULESET, "AvoidReassigningParameters");
    26          addRule(RULESET, "AvoidSynchronizedAtMethodLevel");
    27          addRule(RULESET, "BadComparison");
    28          addRule(RULESET, "ClassWithOnlyPrivateConstructorsShouldBeFinal");
    29          addRule(RULESET, "CloseResource");
    30          addRule(RULESET, "CompareObjectsWithEquals");
    31          addRule(RULESET, "DefaultLabelNotLastInSwitchStmt");
    32          addRule(RULESET, "EmptyMethodInAbstractClassShouldBeAbstract");
    33          addRule(RULESET, "EqualsNull");
    34          addRule(RULESET, "FinalFieldCouldBeStatic");
    35          addRule(RULESET, "FieldDeclarationsShouldBeAtStartOfClass");
    36          addRule(RULESET, "GodClass");
    37          addRule(RULESET, "IdempotentOperations");
    38          addRule(RULESET, "ImmutableField");
    39          addRule(RULESET, "InstantiationToGetClass");
    40          addRule(RULESET, "LogicInversion");
    41          addRule(RULESET, "MissingBreakInSwitch");
    42          addRule(RULESET, "MissingStaticMethodInNonInstantiatableClass");
    43          addRule(RULESET, "NonCaseLabelInSwitchStatement");
    44          addRule(RULESET, "NonStaticInitializer");
    45          addRule(RULESET, "NonThreadSafeSingleton");
    46          addRule(RULESET, "OptimizableToArrayCall");
    47          addRule(RULESET, "PositionLiteralsFirstInComparisons");
    48          addRule(RULESET, "PreserveStackTrace");
    49          addRule(RULESET, "ReturnEmptyArrayRatherThanNull");
    50          addRule(RULESET, "SimpleDateFormatNeedsLocale");
    51          addRule(RULESET, "SimplifyBooleanExpressions");
    52          addRule(RULESET, "SimplifyBooleanReturns");
    53          addRule(RULESET, "SimplifyConditional");
    54          addRule(RULESET, "SingularField");
    55          addRule(RULESET, "SwitchDensity");
    56          addRule(RULESET, "SwitchStmtsShouldHaveDefault");
    57          addRule(RULESET, "TooFewBranchesForASwitchStatement");
    58  //      addRule(RULESET, "TooManyHttpFilter.xml");
    59          addRule(RULESET, "UncommentedEmptyMethod");
    60          addRule(RULESET, "UnnecessaryLocalBeforeReturn");
    61          addRule(RULESET, "UnsynchronizedStaticDateFormatter");
    62          addRule(RULESET, "UseCollectionIsEmpty");
    63          addRule(RULESET, "UseLocaleWithCaseConversions");
    64          addRule(RULESET, "UseNotifyAllInsteadOfNotify");
    65          addRule(RULESET, "UseSingleton");
    66          addRule(RULESET, "UseVarargs");
    67      }
    68
    69      public static junit.framework.Test suite() {
    70          return new junit.framework.JUnit4TestAdapter(DesignRulesTest.class);
    71      }
    72  }