IsFourthANCVisitRule implements IRule { @Override public boolean apply(SafeMap reportFields) { return IntegerUtil.tryParse(reportFields.get(ANC_VISIT_NUMBER_FIELD), 0) == 4; }  @Override boolean apply(SafeMap reportFields);  }
@Test public void shouldPassWhenANCVisitIsTheFourthOne() throws Exception { Map<String, String> fields = EasyMap.create("ancVisitNumber", "4").map(); assertTrue(rule.apply(new SafeMap(fields))); }
@Test public void shouldFailWhenANCVisitIsNotTheFourthOne() throws Exception { Map<String, String> fields = EasyMap.create("ancVisitNumber", "1").map(); assertFalse(rule.apply(new SafeMap(fields))); }