IsMotherDoesNotHaveBadSmellLocheaRule implements IRule { @Override public boolean apply(SafeMap reportFields) { String vaginalProblemsValue = reportFields.get(VAGINAL_PROBLEMS_FIELD_NAME) != null ? reportFields.get(VAGINAL_PROBLEMS_FIELD_NAME) : ""; return !vaginalProblemsValue.contains(BAD_SMELL_LOCHEA_VALUE); }  @Override boolean apply(SafeMap reportFields);  }
@Test public void shouldReturnFalseIfMotherHasBadSmellLochea() { SafeMap safeMap = new SafeMap(create("vaginalProblems", "heavy_bleeding bad_smell_lochea").map()); boolean didRuleApply = rule.apply(safeMap); assertFalse(didRuleApply); }
@Test public void shouldReturnTrueIfMotherDoesNotHaveBadSmellLochea() { boolean didRuleApply = rule.apply(new SafeMap(create("vaginalProblems", "heavy_bleeding").map())); assertTrue(didRuleApply); didRuleApply = rule.apply(new SafeMap().put("vaginalProblems", null)); assertTrue(didRuleApply); }