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, "AvoidProtectedMethodInFinalClassNotExtending");
26          addRule(RULESET, "AvoidReassigningParameters");
27          addRule(RULESET, "AvoidSynchronizedAtMethodLevel");
28          addRule(RULESET, "BadComparison");
29          addRule(RULESET, "ClassWithOnlyPrivateConstructorsShouldBeFinal");
30          addRule(RULESET, "CloseResource");
31          addRule(RULESET, "CompareObjectsWithEquals");
32          addRule(RULESET, "ConfusingTernary");
33          addRule(RULESET, "ConstructorCallsOverridableMethod");
34          addRule(RULESET, "DefaultLabelNotLastInSwitchStmt");
35          addRule(RULESET, "EmptyMethodInAbstractClassShouldBeAbstract");
36          addRule(RULESET, "EqualsNull");
37          addRule(RULESET, "FieldDeclarationsShouldBeAtStartOfClass");
38          addRule(RULESET, "FinalFieldCouldBeStatic");
39          addRule(RULESET, "GodClass");
40          addRule(RULESET, "IdempotentOperations");
41          addRule(RULESET, "ImmutableField");
42          addRule(RULESET, "InstantiationToGetClass");
43          addRule(RULESET, "LogicInversion");
44          addRule(RULESET, "MissingBreakInSwitch");
45          addRule(RULESET, "MissingStaticMethodInNonInstantiatableClass");
46          addRule(RULESET, "NonCaseLabelInSwitchStatement");
47          addRule(RULESET, "NonStaticInitializer");
48          addRule(RULESET, "NonThreadSafeSingleton");
49          addRule(RULESET, "OptimizableToArrayCall");
50          //addRule(RULESET, "PositionalIteratorRule"); This rule does not yet exist
51          addRule(RULESET, "PositionLiteralsFirstInComparisons");
52          addRule(RULESET, "PositionLiteralsFirstInCaseInsensitiveComparisons");
53          addRule(RULESET, "PreserveStackTrace");
54          addRule(RULESET, "ReturnEmptyArrayRatherThanNull");
55          addRule(RULESET, "SimpleDateFormatNeedsLocale");
56          addRule(RULESET, "SimplifyBooleanExpressions");
57          addRule(RULESET, "SimplifyBooleanReturns");
58          addRule(RULESET, "SimplifyConditional");
59          addRule(RULESET, "SingularField");
60          addRule(RULESET, "SwitchDensity");
61          addRule(RULESET, "SwitchStmtsShouldHaveDefault");
62          addRule(RULESET, "TooFewBranchesForASwitchStatement");
63          //addRule(RULESET, "TooManyHttpFilter"); This rule does not yet exist
64          addRule(RULESET, "UncommentedEmptyConstructor");
65          addRule(RULESET, "UncommentedEmptyMethod");
66          addRule(RULESET, "UnnecessaryLocalBeforeReturn");
67          addRule(RULESET, "UnsynchronizedStaticDateFormatter");
68          addRule(RULESET, "UseCollectionIsEmpty");
69          addRule(RULESET, "UseLocaleWithCaseConversions");
70          addRule(RULESET, "UseNotifyAllInsteadOfNotify");
71          addRule(RULESET, "UseUtilityClass");
72          addRule(RULESET, "UseVarargs");
73      }
74  
75      public static junit.framework.Test suite() {
76          return new junit.framework.JUnit4TestAdapter(DesignRulesTest.class);
77      }
78  }