Skip to content

Commit

Permalink
enhance test to test no regression on missing fact
Browse files Browse the repository at this point in the history
  • Loading branch information
bpoussin authored and fmbenhassine committed Mar 27, 2018
1 parent 62f49a7 commit cbf5eee
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,27 @@ public void testNullFact() {
}
}

@Test
public void testMissingFact() {
Rules rules = new Rules();
rules.register(new AnnotatedParametersRule());

Facts facts = new Facts();
facts.put("fact1", new Object());

Map<org.jeasy.rules.api.Rule, Boolean> results = rulesEngine.check(rules, facts);

for (boolean b : results.values()) {
Assert.assertFalse(b);
}
}

@Rule
public class AnnotatedParametersRule {

@Condition
public boolean when(@Fact("fact1") Object fact1, @Fact("fact2") Object fact2) {
return true;
return fact1 != null && fact2 == null;
}

@Action
Expand Down

0 comments on commit cbf5eee

Please sign in to comment.