forked from phoedos/pmd
Doing a JUnit review - checking tests with low coverage for what they're missing
ExcessivePublicCount Rule looks OK, just added some missing JUnit tests git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@4635 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -34,11 +34,20 @@ public class ExcessivePublicCountTest extends RuleTst {
|
||||
public void testSimpleOK() throws Throwable {
|
||||
rule.addProperty("minimum", "50");
|
||||
runTestFromString(TEST1, 0, rule);
|
||||
runTestFromString(TEST4, 0, rule);
|
||||
runTestFromString(TEST5, 0, rule);
|
||||
runTestFromString(TEST6, 0, rule);
|
||||
}
|
||||
|
||||
public void testSimpleBad() throws Throwable {
|
||||
rule.addProperty("minimum", "2");
|
||||
runTestFromString(TEST2, 1, rule);
|
||||
runTestFromString(TEST4, 1, rule);
|
||||
}
|
||||
|
||||
public void testStaticFinal() throws Throwable {
|
||||
rule.addProperty("minimum", "1");
|
||||
runTestFromString(TEST3, 0, rule);
|
||||
}
|
||||
|
||||
private static final String TEST1 =
|
||||
@ -54,4 +63,34 @@ public class ExcessivePublicCountTest extends RuleTst {
|
||||
" public int bof;" + PMD.EOL +
|
||||
"}";
|
||||
|
||||
private static final String TEST3 =
|
||||
"public class Foo {" + PMD.EOL +
|
||||
" public static final int foo;" + PMD.EOL +
|
||||
" public static final int foo1;" + PMD.EOL +
|
||||
" public static final int foo2;" + PMD.EOL +
|
||||
" public static final int foo3;" + PMD.EOL +
|
||||
"}";
|
||||
|
||||
private static final String TEST4 =
|
||||
"public class Foo {" + PMD.EOL +
|
||||
" public int foo1() {return 1;}" + PMD.EOL +
|
||||
" public int foo2() {return 1;}" + PMD.EOL +
|
||||
" public int foo3() {return 1;}" + PMD.EOL +
|
||||
"}";
|
||||
|
||||
private static final String TEST5 =
|
||||
"public class Foo {" + PMD.EOL +
|
||||
" private static final int foo;" + PMD.EOL +
|
||||
" private static final int foo1;" + PMD.EOL +
|
||||
" private static final int foo2;" + PMD.EOL +
|
||||
" private static final int foo3;" + PMD.EOL +
|
||||
"}";
|
||||
|
||||
private static final String TEST6 =
|
||||
"public class Foo {" + PMD.EOL +
|
||||
" private int foo1() {return 1;}" + PMD.EOL +
|
||||
" private int foo2() {return 1;}" + PMD.EOL +
|
||||
" private int foo3() {return 1;}" + PMD.EOL +
|
||||
"}";
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user