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

This page was automatically generated by Maven