Cleanup of test using reinitialization in XML test-data file

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@4851 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Wouter Zelle
2006-11-30 21:32:36 +00:00
parent ab2f5a6a4f
commit 21ef1a3012
2 changed files with 19 additions and 27 deletions

View File

@@ -1,27 +1,19 @@
/**
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/ */
package test.net.sourceforge.pmd.rules; package test.net.sourceforge.pmd.rules;
import net.sourceforge.pmd.Rule; import net.sourceforge.pmd.Rule;
import test.net.sourceforge.pmd.testframework.SimpleAggregatorTst; import test.net.sourceforge.pmd.testframework.SimpleAggregatorTst;
import test.net.sourceforge.pmd.testframework.TestDescriptor;
public class LongVariableRuleTest extends SimpleAggregatorTst { public class LongVariableRuleTest extends SimpleAggregatorTst {
private Rule rule; private Rule rule;
private TestDescriptor[] tests;
public void setUp() { public void setUp() {
rule = findRule("naming", "LongVariable"); rule = findRule("naming", "LongVariable");
tests = extractTestsFromXml(rule);
} }
public void testAll() { public void testAll() {
runTests(new TestDescriptor[] {tests[0], tests[1], tests[2], tests[3], tests[4]}); runTests(rule);
}
public void testThreshold() {
runTest(tests[5]); //Need a fresh rule to work around caching
}
} }
}

View File

@@ -65,7 +65,7 @@ public class Foo {
} }
]]></code> ]]></code>
</test-code> </test-code>
<test-code> <test-code reinitializeRule="true">
<description><![CDATA[ <description><![CDATA[
threshold test threshold test
]]></description> ]]></description>