More rule migration

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@138 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Tom Copeland
2002-06-28 18:40:57 +00:00
parent 901380146c
commit 503b634764
3 changed files with 80 additions and 41 deletions

View File

@ -23,11 +23,6 @@ public class FunctionalTest extends TestCase{
/*
public void testUnnecessaryTemporaries() {
Report report = process("UnnecessaryTemporary.java");
assertEquals(6, report.countViolationsInCurrentFile());
assertEquals(new UnnecessaryConversionTemporaryRule(), ((RuleViolation)report.violationsInCurrentFile().next()).getRule());
}
public void testProps() {
Report report = process("ContainsSystemGetProps.java");
@ -71,42 +66,6 @@ public class FunctionalTest extends TestCase{
assertEquals(new EmptyWhileStmtRule(), ((RuleViolation)report.violationsInCurrentFile().next()).getRule());
}
public void testUnusedPrivateInstanceVar1() {
Report report = process("UnusedPrivateInstanceVar1.java");
assertEquals(1, report.countViolationsInCurrentFile());
Iterator i = report.violationsInCurrentFile();
assertEquals(new UnusedPrivateInstanceVariableRule(), ((RuleViolation)i.next()).getRule());
}
public void testUnusedPrivateInstanceVar2() {
Report report = process("UnusedPrivateInstanceVar2.java");
assertTrue(report.currentFileHasNoViolations());
}
public void testUnusedPrivateInstanceVar3() {
Report report = process("UnusedPrivateInstanceVar3.java");
assertEquals(1, report.countViolationsInCurrentFile());
Iterator i = report.violationsInCurrentFile();
assertEquals(new UnusedPrivateInstanceVariableRule(), ((RuleViolation)i.next()).getRule());
}
public void testUnusedPrivateInstanceVar4() {
Report report = process("UnusedPrivateInstanceVar4.java");
assertTrue(report.currentFileHasNoViolations());
}
public void testUnusedPrivateInstanceVar6() {
Report report = process("UnusedPrivateInstanceVar6.java");
assertTrue(report.currentFileHasNoViolations());
}
public void testUnusedPrivateInstanceVar7() {
Report report = process("UnusedPrivateInstanceVar7.java");
assertTrue(report.currentFileHasNoViolations());
}
public void testUnusedPrivateInstanceVar8() {
Report report = process("UnusedPrivateInstanceVar8.java");
assertTrue(report.currentFileHasNoViolations());
}
public void testIfElseStmtsMustUseBraces1() {
Report report = process("IfElseStmtsNeedBraces1.java");

View File

@ -0,0 +1,24 @@
/*
* User: tom
* Date: Jun 28, 2002
* Time: 2:34:20 PM
*/
package test.net.sourceforge.pmd.rules;
import junit.framework.TestCase;
import net.sourceforge.pmd.Report;
import net.sourceforge.pmd.RuleViolation;
import net.sourceforge.pmd.rules.UnnecessaryConversionTemporaryRule;
public class UnnecessaryTemporariesRuleTest extends RuleTst{
public UnnecessaryTemporariesRuleTest(String name) {
super(name);
}
public void testUnnecessaryTemporaries() {
Report report = process2("UnnecessaryTemporary.java", new UnnecessaryConversionTemporaryRule());
assertEquals(6, report.countViolationsInCurrentFile());
assertEquals(new UnnecessaryConversionTemporaryRule(), ((RuleViolation)report.violationsInCurrentFile().next()).getRule());
}
}

View File

@ -0,0 +1,56 @@
/*
* User: tom
* Date: Jun 28, 2002
* Time: 2:35:51 PM
*/
package test.net.sourceforge.pmd.rules;
import net.sourceforge.pmd.Report;
import net.sourceforge.pmd.RuleViolation;
import net.sourceforge.pmd.rules.UnusedPrivateInstanceVariableRule;
import java.util.Iterator;
public class UnusedPrivateInstanceVariableRuleTest extends RuleTst {
public UnusedPrivateInstanceVariableRuleTest(String name) {
super(name);
}
public void testUnusedPrivateInstanceVar1() {
Report report = process2("UnusedPrivateInstanceVar1.java", new UnusedPrivateInstanceVariableRule());
assertEquals(1, report.countViolationsInCurrentFile());
Iterator i = report.violationsInCurrentFile();
assertEquals(new UnusedPrivateInstanceVariableRule(), ((RuleViolation)i.next()).getRule());
}
public void testUnusedPrivateInstanceVar2() {
Report report = process2("UnusedPrivateInstanceVar2.java", new UnusedPrivateInstanceVariableRule());
assertTrue(report.currentFileHasNoViolations());
}
public void testUnusedPrivateInstanceVar3() {
Report report = process2("UnusedPrivateInstanceVar3.java", new UnusedPrivateInstanceVariableRule());
assertEquals(1, report.countViolationsInCurrentFile());
Iterator i = report.violationsInCurrentFile();
assertEquals(new UnusedPrivateInstanceVariableRule(), ((RuleViolation)i.next()).getRule());
}
public void testUnusedPrivateInstanceVar4() {
Report report = process2("UnusedPrivateInstanceVar4.java", new UnusedPrivateInstanceVariableRule());
assertTrue(report.currentFileHasNoViolations());
}
public void testUnusedPrivateInstanceVar6() {
Report report = process2("UnusedPrivateInstanceVar6.java", new UnusedPrivateInstanceVariableRule());
assertTrue(report.currentFileHasNoViolations());
}
public void testUnusedPrivateInstanceVar7() {
Report report = process2("UnusedPrivateInstanceVar7.java", new UnusedPrivateInstanceVariableRule());
assertTrue(report.currentFileHasNoViolations());
}
public void testUnusedPrivateInstanceVar8() {
Report report = process2("UnusedPrivateInstanceVar8.java", new UnusedPrivateInstanceVariableRule());
assertTrue(report.currentFileHasNoViolations());
}
}