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:
Juan Martín Sotuyo Dodero
2016-11-30 15:25:19 -03:00
parent 555266b1b1
commit 1d6c9327a0
14 changed files with 664 additions and 706 deletions

View File

@@ -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);

View File

@@ -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);
}
}