Recycle the test cases of AvoidConstantsInInterface

This commit is contained in:
Andreas Dangel
2017-01-03 09:59:29 +01:00
parent 7a46613043
commit d6ef39f4d4
2 changed files with 23 additions and 1 deletions

View File

@ -30,6 +30,7 @@ public class DesignRulesTest extends SimpleAggregatorTst {
addRule(RULESET, "CloseResource");
addRule(RULESET, "CompareObjectsWithEquals");
addRule(RULESET, "ConfusingTernary");
addRule(RULESET, "ConstantsInInterface");
addRule(RULESET, "ConstructorCallsOverridableMethod");
addRule(RULESET, "DefaultLabelNotLastInSwitchStmt");
addRule(RULESET, "EmptyMethodInAbstractClassShouldBeAbstract");
@ -73,6 +74,5 @@ public class DesignRulesTest extends SimpleAggregatorTst {
addRule(RULESET, "UseNotifyAllInsteadOfNotify");
addRule(RULESET, "UseUtilityClass");
addRule(RULESET, "UseVarargs");
addRule(RULESET, "ConstantsInInterface");
}
}

View File

@ -61,4 +61,26 @@ public interface SomeInterfaceName {
}
]]></code>
</test-code>
<test-code>
<description>clear rule violation (from AvoidConstantsInInterface)</description>
<expected-problems>2</expected-problems>
<code><![CDATA[
public interface Foo {
public static final int FOO = 2;
public static final String BAR = "bar";
}
]]></code>
</test-code>
<test-code>
<description>ok (from AvoidConstantsInInterface)</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
public interface Foo {
public static final int FOO = 2;
public void buz();
}
]]></code>
</test-code>
</test-data>