LoanTermCondition extends AbstractRangeCondition<Integer> { public static LoanTermCondition exact(final int minimumThreshold, final int maximumThreshold) { final RangeCondition<Integer> c = RangeCondition.exact(Wrapper::getRemainingTermInMonths, LOAN_TERM_IN_MONTHS_DOMAIN, minimumThreshold, maximumThreshold); return new LoanTermCondition(c); } private  LoanTermCondition(final RangeCondition<Integer> condition); static LoanTermCondition lessThan(final int threshold); static LoanTermCondition moreThan(final int threshold); static LoanTermCondition exact(final int minimumThreshold, final int maximumThreshold);  }
@Test void exact() { final MarketplaceFilterCondition condition = LoanTermCondition.exact(0, 1); final Wrapper<?> w = mock(Wrapper.class); when(w.getRemainingTermInMonths()).thenReturn(0); assertThat(condition).accepts(w); when(w.getRemainingTermInMonths()).thenReturn(1); assertThat(condition).accepts(w); when(w.getRemainingTermInMonths()).thenReturn(2); assertThat(condition).rejects(w); }