IUDRemovedAtHomeAtHomeOrSubCenterRule implements IRule { @Override public boolean apply(SafeMap reportFields) { return SUB_CENTER_SERVICE_PROVIDED_PLACE_VALUE.equalsIgnoreCase(reportFields.get(IUD_REMOVAL_PLACE)) || HOME_FIELD_VALUE.equalsIgnoreCase(reportFields.get(IUD_REMOVAL_PLACE)); }  @Override boolean apply(SafeMap reportFields);  }
@Test public void shouldReturnTrueWhenIUDWasRemovedAtHome() throws Exception { boolean rulePassed = rule.apply(new SafeMap(mapOf("iudRemovalPlace", "home"))); assertTrue(rulePassed); }
@Test public void shouldReturnTrueWhenIUDWasRemovedAtSubCenter() throws Exception { boolean rulePassed = rule.apply(new SafeMap(mapOf("iudRemovalPlace", "sub_center"))); assertTrue(rulePassed); }
@Test public void shouldReturnFalseWhenIUDWasRemovedElsewhere() throws Exception { boolean rulePassed = rule.apply(new SafeMap(mapOf("iudRemovalPlace", "phc"))); assertFalse(rulePassed); rulePassed = rule.apply(new SafeMap(mapOf("iudRemovalPlace", "elsewhere"))); assertFalse(rulePassed); }