ServiceProvidedAtSubCenterRule implements IRule { @Override public boolean apply(SafeMap reportFields) { return reportFields.has(SERVICE_PROVIDED_PLACE) && SUBCENTER_SERVICE_PROVIDED_PLACE_VALUE.equalsIgnoreCase(reportFields.get(SERVICE_PROVIDED_PLACE)); }  @Override boolean apply(SafeMap reportFields);  }
@Test public void shouldReturnTrueWhenServiceProvidedPlaceIsSubCenter() throws Exception { boolean rulePassed = rule.apply(new SafeMap(mapOf("serviceProvidedPlace", "subcenter"))); assertTrue(rulePassed); }
@Test public void shouldReturnFalseWhenServiceProvidedPlaceIsNotSubCenter() throws Exception { boolean rulePassed = rule.apply(new SafeMap(mapOf("serviceProvidedPlace", "phc"))); assertFalse(rulePassed); rulePassed = rule.apply(new SafeMap(mapOf("serviceProvidedPlace", "elsewhere"))); assertFalse(rulePassed); rulePassed = rule.apply(new SafeMap()); assertFalse(rulePassed); }