use of org.mifos.accounts.loan.schedule.calculation.ScheduleCalculator in project head by mifos.
the class ScheduleCalculatorAdaptorTest method computeExtraInterestAndPopulateInLoanScheduleEntities.
@Test
public void computeExtraInterestAndPopulateInLoanScheduleEntities() {
List<Installment> installments = getInstallments(0, 0, 0);
Schedule schedule = new Schedule(DISBURSEMENT_DATE, DAILY_INTEREST_RATE, LOAN_AMOUNT, installments);
new ScheduleCalculator().computeExtraInterest(schedule, getDate(30, 10, 2010));
Set<LoanScheduleEntity> loanScheduleEntities = getLoanScheduleEntities();
Map<Integer, LoanScheduleEntity> loanScheduleEntityMap = getLoanScheduleEntityMap(loanScheduleEntities);
assertThat(schedule.getInstallments().get(2).getExtraInterest().doubleValue(), is(0.46));
scheduleCalculatorAdaptor.populateExtraInterestInLoanScheduleEntities(schedule, loanScheduleEntityMap);
for (Installment installment : installments) {
LoanScheduleEntity loanScheduleEntity = loanScheduleEntityMap.get(installment.getId());
assertExtraInterest(loanScheduleEntity, installment.getExtraInterest().doubleValue());
}
}
Aggregations