View Javadoc

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