IsDeathDueToSterilizationRule implements IRule { @Override public boolean apply(SafeMap reportFields) { return BOOLEAN_TRUE_VALUE.equalsIgnoreCase(reportFields.get(IS_STERILIZATION_DEATH_FIELD_NAME)); }  @Override boolean apply(SafeMap reportFields);  }
@Test public void shouldReturnFalseWhenDeathIsNotDueToSterilization() { boolean didRuleSucceed = rule.apply(new SafeMap().put("isSterilizationDeath", null)); assertFalse(didRuleSucceed); didRuleSucceed = rule.apply(new SafeMap().put("isSterilizationDeath", "")); assertFalse(didRuleSucceed); didRuleSucceed = rule.apply(new SafeMap().put("isSterilizationDeath", "no")); assertFalse(didRuleSucceed); }
@Test public void shouldReturnTrueWhenDeathIsDueToSterilization() { boolean didRuleSucceed = rule.apply(new SafeMap().put("isSterilizationDeath", "yes")); assertTrue(didRuleSucceed); }