@Test
public void testVerifyRuleFired() throws Exception {
RuleFiredVerifier ruleFiredVerifier = new RuleFiredVerifier();
VerifyRuleFired vr = new VerifyRuleFired("qqq",
42,
null);
Map<String, Integer> f = new HashMap<String, Integer>();
f.put("qqq",
42);
f.put("qaz",
1);
ruleFiredVerifier.setFireCounter(f);
ruleFiredVerifier.verifyFiringCounts(vr);
assertTrue(vr.wasSuccessful());
assertEquals(42,
vr.getActualResult().intValue());
vr = new VerifyRuleFired("qqq",
41,
null);
ruleFiredVerifier.setFireCounter(f);
ruleFiredVerifier.verifyFiringCounts(vr);
assertFalse(vr.wasSuccessful());
assertEquals(42,
vr.getActualResult().intValue());
vr = new VerifyRuleFired("qaz",
1,
null);
ruleFiredVerifier.setFireCounter(f);
ruleFiredVerifier.verifyFiringCounts(vr);
assertTrue(vr.wasSuccessful());
assertEquals(1,
vr.getActualResult().intValue());
vr = new VerifyRuleFired("XXX",
null,
false);
ruleFiredVerifier.setFireCounter(f);
ruleFiredVerifier.verifyFiringCounts(vr);
assertTrue(vr.wasSuccessful());
assertEquals(0,
vr.getActualResult().intValue());
vr = new VerifyRuleFired("qqq",
null,
true);
ruleFiredVerifier.setFireCounter(f);
ruleFiredVerifier.verifyFiringCounts(vr);
assertTrue(vr.wasSuccessful());
assertEquals(42,
vr.getActualResult().intValue());
vr = new VerifyRuleFired("qqq",
null,
false);
ruleFiredVerifier.setFireCounter(f);
ruleFiredVerifier.verifyFiringCounts(vr);
assertFalse(vr.wasSuccessful());
assertEquals(42,
vr.getActualResult().intValue());
}