forked from phoedos/pmd
Refactor RuleSet creation
- RuleSet is now immutable - RuleSets are created through a RuleSetBuilder - RuleSetBuilder is accessed solely from RuleSetFactory - RuleSetFactory can now either parse XMLs for rule set creation, or create single rule rulesets
This commit is contained in:
@@ -214,8 +214,7 @@ public abstract class RuleTst {
|
||||
ctx.setSourceCodeFilename("n/a");
|
||||
ctx.setLanguageVersion(languageVersion);
|
||||
ctx.setIgnoreExceptions(false);
|
||||
RuleSet rules = new RuleSet();
|
||||
rules.addRule(rule);
|
||||
RuleSet rules = new RuleSetFactory().createSingleRuleRuleSet(rule);
|
||||
rules.start(ctx);
|
||||
p.getSourceCodeProcessor().processSourceCode(new StringReader(code), new RuleSets(rules), ctx);
|
||||
rules.end(ctx);
|
||||
|
@@ -41,7 +41,8 @@ public class RuleTstTest {
|
||||
verify(rule).getMinimumLanguageVersion();
|
||||
verify(rule).getMaximumLanguageVersion();
|
||||
verify(rule).apply(anyList(), any(RuleContext.class));
|
||||
verify(rule).getName();
|
||||
verify(rule, times(2)).getName();
|
||||
verify(rule).getPropertiesByPropertyDescriptor();
|
||||
verifyNoMoreInteractions(rule);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user