|
[pmd-devel] pmd/regress/test/net/sourceforge/pmd/rules CouplingBetweenObjectsRuleTest.java,1.8,1.9
From: Tom Copeland <tomcopeland@us...> - 2004-10-28 19:31
|
Update of /cvsroot/pmd/pmd/regress/test/net/sourceforge/pmd/rules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2492/regress/test/net/sourceforge/pmd/rules
Modified Files:
CouplingBetweenObjectsRuleTest.java
Log Message:
Fixed bug 1055930 - CouplingBetweenObjectsRule no longer throws a NPE on interfaces
Index: CouplingBetweenObjectsRuleTest.java
===================================================================
RCS file: /cvsroot/pmd/pmd/regress/test/net/sourceforge/pmd/rules/CouplingBetweenObjectsRuleTest.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** CouplingBetweenObjectsRuleTest.java 26 Nov 2003 15:04:32 -0000 1.8
--- CouplingBetweenObjectsRuleTest.java 28 Oct 2004 19:31:12 -0000 1.9
***************
*** 6,17 ****
import net.sourceforge.pmd.PMD;
import net.sourceforge.pmd.Rule;
import net.sourceforge.pmd.rules.CouplingBetweenObjectsRule;
import test.net.sourceforge.pmd.testframework.RuleTst;
! public class CouplingBetweenObjectsRuleTest extends RuleTst {
private static final String TEST1 =
"import java.util.*;" + PMD.EOL +
! "public class CouplingBetweenObjects1 {" + PMD.EOL +
" public List foo() {return null;}" + PMD.EOL +
" public ArrayList foo() {return null;}" + PMD.EOL +
--- 6,35 ----
import net.sourceforge.pmd.PMD;
import net.sourceforge.pmd.Rule;
+ import net.sourceforge.pmd.RuleSetNotFoundException;
import net.sourceforge.pmd.rules.CouplingBetweenObjectsRule;
import test.net.sourceforge.pmd.testframework.RuleTst;
+ import test.net.sourceforge.pmd.testframework.TestDescriptor;
+ import test.net.sourceforge.pmd.testframework.SimpleAggregatorTst;
! public class CouplingBetweenObjectsRuleTest extends SimpleAggregatorTst {
!
! private Rule rule;
!
! public void setUp() throws RuleSetNotFoundException {
! rule = findRule("rulesets/coupling.xml", "CouplingBetweenObjectsRule");
! rule.addProperty("threshold", "2");
! }
!
! public void testAll() {
! runTests(new TestDescriptor[] {
! new TestDescriptor(TEST1, "lots of coupling", 1, rule),
! new TestDescriptor(TEST2, "no coupling", 0, rule),
! new TestDescriptor(TEST3, "skip interfaces", 0, rule),
! });
! }
private static final String TEST1 =
"import java.util.*;" + PMD.EOL +
! "public class Foo {" + PMD.EOL +
" public List foo() {return null;}" + PMD.EOL +
" public ArrayList foo() {return null;}" + PMD.EOL +
***************
*** 20,40 ****
private static final String TEST2 =
! "public class CouplingBetweenObjects2 {" + PMD.EOL +
"}";
- private Rule rule;
-
- public void setUp() {
- rule = new CouplingBetweenObjectsRule();
- rule.addProperty("threshold", "2");
- }
-
- public void testSimpleBad() throws Throwable {
- runTestFromString(TEST1, 1, rule);
- }
- public void testSimpleOK() throws Throwable {
- runTestFromString(TEST2, 0, rule);
- }
}
--- 38,49 ----
private static final String TEST2 =
! "public class Foo {" + PMD.EOL +
"}";
+ private static final String TEST3 =
+ "public interface Foo {" + PMD.EOL +
+ " public static final int FOO = 2; " + PMD.EOL +
+ "}";
}
|
| Thread | Author | Date |
|---|---|---|
| [pmd-devel] pmd/regress/test/net/sourceforge/pmd/rules CouplingBetweenObjectsRuleTest.java,1.8,1.9 | Tom Copeland <tomcopeland@us...> |