DeliveryHappenedAtHomeRule implements IRule { @Override public boolean apply(SafeMap reportFields) { return HOME_FIELD_VALUE.equalsIgnoreCase(reportFields.get(DELIVERY_PLACE)); }  @Override boolean apply(SafeMap reportFields);  }
@Test public void shouldReturnTrueWhenDeliveryHappenedAtHome() throws Exception { boolean rulePassed = deliveryHappenedAtHomeRule.apply(new SafeMap(mapOf("deliveryPlace", "home"))); assertTrue(rulePassed); }
@Test public void shouldReturnFalseWhenDeliveryHappenedNotAtHome() throws Exception { boolean rulePassed = deliveryHappenedAtHomeRule.apply(new SafeMap(mapOf("deliveryPlace", "subcenter"))); assertFalse(rulePassed); rulePassed = deliveryHappenedAtHomeRule.apply(new SafeMap(mapOf("deliveryPlace", "phc"))); assertFalse(rulePassed); }