LoanWrapper extends AbstractWrapper<LoanDescriptor> { @Override public String toString() { return "Wrapper for loan #" + getId(); } LoanWrapper(final LoanDescriptor original, final PortfolioOverview portfolioOverview); @Override long getId(); @Override boolean isInsuranceActive(); @Override Region getRegion(); @Override String getStory(); @Override MainIncomeType getMainIncomeType(); @Override Ratio getInterestRate(); @Override Ratio getRevenueRate(); @Override Purpose getPurpose(); @Override Rating getRating(); @Override int getOriginalTermInMonths(); @Override int getRemainingTermInMonths(); @Override int getOriginalAmount(); @Override int getOriginalAnnuity(); @Override OptionalInt getCurrentDpd(); @Override OptionalInt getLongestDpd(); @Override OptionalInt getDaysSinceDpd(); @Override BigDecimal getRemainingPrincipal(); @Override String toString();  }
@Test void equality() { final LoanImpl l = new MockLoanBuilder() .set(LoanImpl::setInsuranceActive, true) .set(LoanImpl::setAmount, Money.from(100_000)) .set(LoanImpl::setRating, Rating.D) .set(LoanImpl::setInterestRate, Ratio.ONE) .set(LoanImpl::setMainIncomeType, MainIncomeType.EMPLOYMENT) .set(LoanImpl::setPurpose, Purpose.AUTO_MOTO) .set(LoanImpl::setRegion, Region.JIHOCESKY) .set(LoanImpl::setStory, UUID.randomUUID() .toString()) .set(LoanImpl::setTermInMonths, 20) .build(); final LoanDescriptor original = new LoanDescriptor(l); final Wrapper<LoanDescriptor> w = Wrapper.wrap(original, FOLIO); assertSoftly(softly -> { softly.assertThat(w) .isEqualTo(w); softly.assertThat(w) .isEqualTo(Wrapper.wrap(original, FOLIO)); softly.assertThat(w) .isEqualTo(Wrapper.wrap(new LoanDescriptor(l), FOLIO)); softly.assertThat(w) .isNotEqualTo(Wrapper.wrap(new LoanDescriptor(MockLoanBuilder.fresh()), FOLIO)); softly.assertThat(w) .isNotEqualTo(null); }); }