### Question:
MVELRuleFactory extends AbstractRuleFactory { public Rules createRules(Reader rulesDescriptor) throws Exception { Rules rules = new Rules(); List<RuleDefinition> ruleDefinitions = reader.read(rulesDescriptor); for (RuleDefinition ruleDefinition : ruleDefinitions) { rules.register(createRule(ruleDefinition)); } return rules; } MVELRuleFactory(RuleDefinitionReader reader);  MVELRuleFactory(RuleDefinitionReader reader, ParserContext parserContext); Rule createRule(Reader ruleDescriptor); Rules createRules(Reader rulesDescriptor);  }### Answer:
@Test public void testRulesCreation() throws Exception { File rulesDescriptor = new File("src/test/resources/rules." + fileExtension); Rules rules = factory.createRules(new FileReader(rulesDescriptor)); assertThat(rules).hasSize(2); Iterator<Rule> iterator = rules.iterator(); Rule rule = iterator.next(); assertThat(rule).isNotNull(); assertThat(rule.getName()).isEqualTo("adult rule"); assertThat(rule.getDescription()).isEqualTo("when age is greater than 18, then mark as adult"); assertThat(rule.getPriority()).isEqualTo(1); rule = iterator.next(); assertThat(rule).isNotNull(); assertThat(rule.getName()).isEqualTo("weather rule"); assertThat(rule.getDescription()).isEqualTo("when it rains, then take an umbrella"); assertThat(rule.getPriority()).isEqualTo(2); }
@Test public void testRuleCreationFromFileReader_withCompositeRules() throws Exception { File rulesDescriptor = new File("src/test/resources/composite-rules." + fileExtension); Rules rules = factory.createRules(new FileReader(rulesDescriptor)); assertThat(rules).hasSize(2); Iterator<Rule> iterator = rules.iterator(); Rule rule = iterator.next(); assertThat(rule).isNotNull(); assertThat(rule.getName()).isEqualTo("Movie id rule"); assertThat(rule.getDescription()).isEqualTo("description"); assertThat(rule.getPriority()).isEqualTo(1); assertThat(rule).isInstanceOf(UnitRuleGroup.class); rule = iterator.next(); assertThat(rule).isNotNull(); assertThat(rule.getName()).isEqualTo("weather rule"); assertThat(rule.getDescription()).isEqualTo("when it rains, then take an umbrella"); assertThat(rule.getPriority()).isEqualTo(1); }