private static MyInvestment mockMyInvestment(final OffsetDateTime creationDate) { final MyInvestment m = mock(MyInvestment.class); when(m.getId()).thenReturn(RANDOM.nextLong()); when(m.getTimeCreated()).thenReturn(creationDate); return m; }
MutableInvestmentImpl(final MarketplaceLoan loan, final BigDecimal originalPrincipal) { loan.getMyInvestment().ifPresent(i -> { this.id = i.getId(); this.investmentDate.set(i.getTimeCreated()); }); this.loanId = loan.getId(); this.currentTerm = loan.getTermInMonths(); this.originalTerm = loan.getTermInMonths(); this.remainingMonths = loan.getTermInMonths(); this.daysPastDue = 0; this.canBeOffered = false; this.isOnSmp = false; this.originalPrincipal = originalPrincipal; this.interestRate = loan.getInterestRate(); this.paidPrincipal = BigDecimal.ZERO; this.duePrincipal = BigDecimal.ZERO; this.paidInterest = BigDecimal.ZERO; this.dueInterest = BigDecimal.ZERO; this.paidPenalty = BigDecimal.ZERO; this.remainingPrincipal = originalPrincipal; this.rating = loan.getRating(); this.isInWithdrawal = false; this.status = InvestmentStatus.ACTIVE; this.paymentStatus = PaymentStatus.NOT_COVERED; this.isInsuranceActive = loan.isInsuranceActive(); this.areInstalmentsPostponed = false; this.setInsuranceHistory(loan.getInsuranceHistory()); }
MutableInvestmentImpl(final MarketplaceLoan loan, final BigDecimal originalPrincipal) { loan.getMyInvestment().ifPresent(i -> { this.id = i.getId(); this.investmentDate.set(i.getTimeCreated()); }); this.loanId = loan.getId(); this.currentTerm = loan.getTermInMonths(); this.originalTerm = loan.getTermInMonths(); this.remainingMonths = loan.getTermInMonths(); this.daysPastDue = 0; this.canBeOffered = false; this.isOnSmp = false; this.originalPrincipal = originalPrincipal; this.interestRate = loan.getInterestRate(); this.paidPrincipal = BigDecimal.ZERO; this.duePrincipal = BigDecimal.ZERO; this.paidInterest = BigDecimal.ZERO; this.dueInterest = BigDecimal.ZERO; this.paidPenalty = BigDecimal.ZERO; this.remainingPrincipal = originalPrincipal; this.rating = loan.getRating(); this.isInWithdrawal = false; this.status = InvestmentStatus.ACTIVE; this.paymentStatus = PaymentStatus.NOT_COVERED; this.isInsuranceActive = loan.isInsuranceActive(); this.areInstalmentsPostponed = false; this.setInsuranceHistory(loan.getInsuranceHistory()); }