RelativeElapsedLoanTermCondition extends AbstractRelativeRangeCondition { public static RelativeElapsedLoanTermCondition exact(final Ratio minimumThreshold, final Ratio maximumThreshold) { final RangeCondition<Ratio> c = RangeCondition.relativeExact(RelativeElapsedLoanTermCondition::getElapsedTerm, Wrapper::getOriginalTermInMonths, minimumThreshold, maximumThreshold); return new RelativeElapsedLoanTermCondition(c); } private  RelativeElapsedLoanTermCondition(final RangeCondition<Ratio> condition); static RelativeElapsedLoanTermCondition lessThan(final Ratio threshold); static RelativeElapsedLoanTermCondition moreThan(final Ratio threshold); static RelativeElapsedLoanTermCondition exact(final Ratio minimumThreshold, final Ratio maximumThreshold);  }
@Test void exact() { final MarketplaceFilterCondition condition = RelativeElapsedLoanTermCondition.exact(Ratio.fromPercentage(0), Ratio.fromPercentage(10)); final Wrapper<?> w = mock(Wrapper.class); when(w.getOriginalTermInMonths()).thenReturn(10); when(w.getRemainingTermInMonths()).thenReturn(10); assertThat(condition).accepts(w); when(w.getRemainingTermInMonths()).thenReturn(9); assertThat(condition).accepts(w); when(w.getRemainingTermInMonths()).thenReturn(8); assertThat(condition).rejects(w); }
@Test void hasDescription() { final MarketplaceFilterCondition condition = RelativeElapsedLoanTermCondition.exact(Ratio.ONE, Ratio.ONE); assertThat(condition.getDescription()).isNotEmpty(); }