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; }
public Transaction(final long id, final Loan loan, final BigDecimal amount, final TransactionCategory category, final TransactionOrientation orientation) { this.id = id; this.amount = amount; this.category = category; this.orientation = orientation; this.transactionDate = DateUtil.offsetNow(); this.customMessage = ""; this.loanId = loan.getId(); loan.getMyInvestment().ifPresent(i -> this.investmentId = i.getId()); this.loanName = loan.getName(); this.nickName = loan.getNickName(); this.discount = BigDecimal.ZERO; }
public Transaction(final long id, final Loan loan, final BigDecimal amount, final TransactionCategory category, final TransactionOrientation orientation) { this.id = id; this.amount = amount; this.category = category; this.orientation = orientation; this.transactionDate = DateUtil.offsetNow(); this.customMessage = ""; this.loanId = loan.getId(); loan.getMyInvestment().ifPresent(i -> this.investmentId = i.getId()); this.loanName = loan.getName(); this.nickName = loan.getNickName(); this.discount = BigDecimal.ZERO; }
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()); }