Class RuleTst
- java.lang.Object
-
- net.sourceforge.pmd.testframework.RuleTst
-
- Direct Known Subclasses:
PmdRuleTst
,SimpleAggregatorTst
public abstract class RuleTst extends Object
Advanced methods for test cases
-
-
Constructor Summary
Constructors Constructor Description RuleTst()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description TestDescriptor[]
extractTestsFromXml(Rule rule)
Deprecated.TestDescriptor[]
extractTestsFromXml(Rule rule, String testsFileName)
Deprecated.TestDescriptor[]
extractTestsFromXml(Rule rule, String testsFileName, String baseDirectory)
Deprecated.Rule
findRule(String ruleSet, String ruleName)
Find a rule in a certain ruleset by name todo make this staticprotected String
getCleanRuleName(Rule rule)
Deprecated.protected List<Rule>
getRules()
protected Rule
reinitializeRule(Rule rule)
Code to be executed if the rule is reinitialised.void
runTest(TestDescriptor test)
Deprecated.void
runTestFromString(String code, Rule rule, Report report, LanguageVersion languageVersion)
Deprecated.void
runTestFromString(String code, Rule rule, Report report, LanguageVersion languageVersion, boolean isUseAuxClasspath)
Deprecated.void
runTestFromString(TestDescriptor test, Rule rule, Report report)
Deprecated.void
runTests(Rule rule)
Run a set of tests defined in an XML test-data file for a rule.void
runTests(Rule rule, String testsFileName)
Run a set of tests defined in a XML test-data file.void
runTests(TestDescriptor[] tests)
Deprecated.protected void
setUp()
-
-
-
Method Detail
-
setUp
protected void setUp()
-
findRule
public Rule findRule(String ruleSet, String ruleName)
Find a rule in a certain ruleset by name todo make this static
-
runTest
@InternalApi @Deprecated public void runTest(TestDescriptor test)
Deprecated.Run the rule on the given code, and check the expected number of violations.
-
reinitializeRule
protected Rule reinitializeRule(Rule rule)
Code to be executed if the rule is reinitialised.- Parameters:
rule
- The rule to reinitialise- Returns:
- The rule once it has been reinitialised
-
runTestFromString
@InternalApi @Deprecated public void runTestFromString(String code, Rule rule, Report report, LanguageVersion languageVersion)
Deprecated.Run the rule on the given code and put the violations in the report.
-
runTestFromString
@InternalApi @Deprecated public void runTestFromString(String code, Rule rule, Report report, LanguageVersion languageVersion, boolean isUseAuxClasspath)
Deprecated.
-
runTestFromString
@InternalApi @Deprecated public void runTestFromString(TestDescriptor test, Rule rule, Report report)
Deprecated.
-
getCleanRuleName
@InternalApi @Deprecated protected String getCleanRuleName(Rule rule)
Deprecated.getResourceAsStream tries to find the XML file in weird locations if the ruleName includes the package, so we strip it here.
-
extractTestsFromXml
@InternalApi @Deprecated public TestDescriptor[] extractTestsFromXml(Rule rule)
Deprecated.Extract a set of tests from an XML file. The file should be ./xml/RuleName.xml relative to the test class. The format is defined in test-data.xsd.
-
extractTestsFromXml
@InternalApi @Deprecated public TestDescriptor[] extractTestsFromXml(Rule rule, String testsFileName)
Deprecated.
-
extractTestsFromXml
@InternalApi @Deprecated public TestDescriptor[] extractTestsFromXml(Rule rule, String testsFileName, String baseDirectory)
Deprecated.Extract a set of tests from an XML file with the given name. The file should be ./xml/[testsFileName].xml relative to the test class. The format is defined in test-data.xsd.
-
runTests
public void runTests(Rule rule)
Run a set of tests defined in an XML test-data file for a rule. The file should be ./xml/RuleName.xml relative to the test-class. The format is defined in test-data.xsd.
-
runTests
public void runTests(Rule rule, String testsFileName)
Run a set of tests defined in a XML test-data file. The file should be ./xml/[testsFileName].xml relative to the test-class. The format is defined in test-data.xsd.
-
runTests
@InternalApi @Deprecated public void runTests(TestDescriptor[] tests)
Deprecated.Run a set of tests of a certain sourceType.
-
-