IsRiskObservedBleedingRule implements IRule { @Override public boolean apply(SafeMap reportFields) { String risksObserved = reportFields.get(RISK_OBSERVED_DURING_ANC); return (risksObserved != null) && risksObserved.contains(BLEEDING_VALUE); }  @Override boolean apply(SafeMap reportFields);  }
@Test public void shouldPassWhenRiskObservedHasBleeding() throws Exception { SafeMap fields = new SafeMap(create("riskObservedDuringANC", "bleeding pallor").map()); assertTrue(rule.apply(fields)); }
@Test public void shouldFailWhenRiskObservedDoesNotHaveBleeding() throws Exception { SafeMap fields = new SafeMap(create("riskObservedDuringANC", "pallor").map()); assertFalse(rule.apply(fields)); fields = new SafeMap(); fields.put("riskObservedDuringANC", null); assertFalse(rule.apply(fields)); }