MoreThanZeroCondomsSuppliedRule implements IRule { @Override public boolean apply(SafeMap reportFields) { return IntegerUtil.tryParse(reportFields.get(NUMBER_OF_CONDOMS_SUPPLIED_FIELD_NAME), 0) > 0; }  @Override boolean apply(SafeMap reportFields);  }
@Test public void shouldReturnFalseWhenNoCondomsAreSupplied() throws Exception { assertFalse(rule.apply(new SafeMap().put("numberOfCondomsSupplied", null))); assertFalse(rule.apply(new SafeMap().put("numberOfCondomsSupplied", ""))); }
@Test public void shouldReturnFalseWhenZeroCondomsAreSupplied() throws Exception { assertFalse(rule.apply(new SafeMap().put("numberOfCondomsSupplied", "0"))); }
@Test public void shouldReturnTrueWhenMoreThanZeroCondomsAreSupplied() throws Exception { assertTrue(rule.apply(new SafeMap().put("numberOfCondomsSupplied", "1"))); }