RelativeLoanTermCondition extends AbstractRelativeRangeCondition { public static RelativeLoanTermCondition exact(final Ratio minimumThreshold, final Ratio maximumThreshold) { final RangeCondition<Ratio> c = RangeCondition.relativeExact(Wrapper::getRemainingTermInMonths, Wrapper::getOriginalTermInMonths, minimumThreshold, maximumThreshold); return new RelativeLoanTermCondition(c); } private  RelativeLoanTermCondition(final RangeCondition<Ratio> condition); static RelativeLoanTermCondition lessThan(final Ratio threshold); static RelativeLoanTermCondition moreThan(final Ratio threshold); static RelativeLoanTermCondition exact(final Ratio minimumThreshold, final Ratio maximumThreshold);  }
@Test void exact() { final MarketplaceFilterCondition condition = RelativeLoanTermCondition.exact(Ratio.fromPercentage(0), Ratio.fromPercentage(10)); final Wrapper<?> w = mock(Wrapper.class); when(w.getOriginalTermInMonths()).thenReturn(10); 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); }