IsDeathWasCausedByOthersRule implements IRule { @Override public boolean apply(SafeMap reportFields) { return OTHERS_LIST.contains(reportFields.get(DEATH_CAUSE)) || OTHERS_VALUE_LIST.contains(reportFields.get(DEATH_CAUSE)); }  @Override boolean apply(SafeMap reportFields);  }
@Test public void shouldReturnTrueIfDeathWasCausedByOtherReasons() { boolean didRuleApply = rule.apply(new SafeMap(create("deathCause", "malnutrition").map())); assertTrue(didRuleApply); didRuleApply = rule.apply(new SafeMap(create("deathCause", "ari").map())); assertTrue(didRuleApply); didRuleApply = rule.apply(new SafeMap(create("deathCause", "malaria").map())); assertTrue(didRuleApply); didRuleApply = rule.apply(new SafeMap(create("deathCause", "cause_not_identified").map())); assertTrue(didRuleApply); didRuleApply = rule.apply(new SafeMap(create("deathCause", "others").map())); assertTrue(didRuleApply); }
@Test public void shouldReturnFalseIfDeathWasNotCausedByOtherReasons() { boolean didRuleApply = rule.apply(new SafeMap(create("deathCause", "within_24hrs").map())); assertFalse(didRuleApply); }