IsMotherClosedDueToDeathOfWomanRule implements IRule { @Override public boolean apply(SafeMap reportFields) { return DEATH_OF_WOMAN_VALUE.equalsIgnoreCase(reportFields.get(CLOSE_REASON_FIELD_NAME)); }  @Override boolean apply(SafeMap reportFields);  }
@Test public void shouldReturnTrueIfCloseReasonIsDeathOfWoman() { SafeMap safeMap = new SafeMap(create("closeReason", "death_of_woman").map()); boolean didRuleApply = rule.apply(safeMap); assertTrue(didRuleApply); }
@Test public void shouldReturnFalseIfDeathReasonIsNotDeathOfWoman() { boolean didRuleApply = rule.apply(new SafeMap(create("closeReason", "permanent_relocation").map())); assertFalse(didRuleApply); didRuleApply = rule.apply(new SafeMap(create("closeReason", "death_of_mother").map())); assertFalse(didRuleApply); didRuleApply = rule.apply(new SafeMap().put("closeReason", null)); assertFalse(didRuleApply); }