use of de.prob.model.brules.RuleResults.ResultSummary in project prob2 by bendisposto.
the class RulesMachineTest method testSimpleRulesMachine.
@Test
public void testSimpleRulesMachine() throws IOException {
RulesMachineRun rulesMachineRun = startRulesMachineRun(dir + "SimpleRulesMachine.rmch");
assertEquals(false, rulesMachineRun.hasError());
assertTrue(rulesMachineRun.getErrorList().isEmpty());
assertEquals(null, rulesMachineRun.getFirstError());
RuleResults ruleResults = rulesMachineRun.getRuleResults();
ResultSummary summary = ruleResults.getSummary();
// summary is created only once
assertEquals(summary, ruleResults.getSummary());
assertEquals(4, ruleResults.getRuleResultList().size());
RuleResult rule1Result = ruleResults.getRuleResult("Rule1");
assertEquals(RuleStatus.SUCCESS, rule1Result.getRuleState());
RuleOperation rule1Operation = rule1Result.getRuleOperation();
assertEquals("Rule1", rule1Operation.getName());
assertTrue("Should be empty", rule1Result.getNotCheckedDependencies().isEmpty());
RuleResult result2 = ruleResults.getRuleResult("Rule2");
assertEquals(RuleStatus.FAIL, result2.getRuleState());
String message = result2.getCounterExamples().get(0).getMessage();
assertEquals("ERROR2", message);
assertEquals(NOT_CHECKED, ruleResults.getRuleResult("Rule3").getRuleState());
assertEquals("Rule2", ruleResults.getRuleResult("Rule3").getFailedDependencies().get(0));
}
Aggregations