View Javadoc
1 package test.net.sourceforge.pmd.rules; 2 3 import net.sourceforge.pmd.PMD; 4 import net.sourceforge.pmd.Rule; 5 import net.sourceforge.pmd.rules.CouplingBetweenObjectsRule; 6 7 public class CouplingBetweenObjectsRuleTest extends RuleTst { 8 9 private static final String TEST1 = 10 "import java.util.*;" + PMD.EOL + 11 "" + PMD.EOL + 12 "public class CouplingBetweenObjects1 {" + PMD.EOL + 13 " public List foo() {return null;}" + PMD.EOL + 14 " public ArrayList foo() {return null;}" + PMD.EOL + 15 " public Vector foo() {return null;}" + PMD.EOL + 16 "}"; 17 18 private static final String TEST2 = 19 "public class CouplingBetweenObjects2 {" + PMD.EOL + 20 "}"; 21 22 23 private Rule rule; 24 25 public void setUp() { 26 rule = new CouplingBetweenObjectsRule(); 27 rule.addProperty("threshold", "2"); 28 } 29 30 public void testSimpleBad() throws Throwable { 31 runTestFromString(TEST1, 1, rule); 32 } 33 34 public void testSimpleOK() throws Throwable { 35 runTestFromString(TEST2, 0, rule); 36 } 37 }

This page was automatically generated by Maven