Class RuleTst

java.lang.Object
net.sourceforge.pmd.test.RuleTst
Direct Known Subclasses:
PmdRuleTst, SimpleAggregatorTst

public abstract class RuleTst extends Object
Advanced methods for test cases
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.sourceforge.pmd.lang.rule.Rule
    findRule(String ruleSet, String ruleName)
    Find a rule in a certain ruleset by name.
    protected Collection<? extends net.sourceforge.pmd.lang.rule.Rule>
    Return extra rules that will be run while running the tests.
    protected List<net.sourceforge.pmd.lang.rule.Rule>
    Return the rules that will be tested.
    void
    runTests(net.sourceforge.pmd.lang.rule.Rule rule)
    Run a set of tests defined in an XML test-data file for a rule.
    void
    runTests(net.sourceforge.pmd.lang.rule.Rule rule, String testsFileName)
    Run a set of tests defined in a XML test-data file.
    protected void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RuleTst

      public RuleTst()
  • Method Details

    • setUp

      protected void setUp()
    • getRules

      protected List<net.sourceforge.pmd.lang.rule.Rule> getRules()
      Return the rules that will be tested. Each rule must have a corresponding XML file containing a test collection. Test collections for all these rules are run separately.
    • getExtraRules

      protected Collection<? extends net.sourceforge.pmd.lang.rule.Rule> getExtraRules()
      Return extra rules that will be run while running the tests.
    • findRule

      public static net.sourceforge.pmd.lang.rule.Rule findRule(String ruleSet, String ruleName)
      Find a rule in a certain ruleset by name.
    • runTests

      public void runTests(net.sourceforge.pmd.lang.rule.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(net.sourceforge.pmd.lang.rule.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.