Search in sources :

Example 1 with ScheduleCalculator

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());
    }
}
Also used : Installment(org.mifos.accounts.loan.schedule.domain.Installment) Schedule(org.mifos.accounts.loan.schedule.domain.Schedule) ScheduleCalculator(org.mifos.accounts.loan.schedule.calculation.ScheduleCalculator) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 ScheduleCalculator (org.mifos.accounts.loan.schedule.calculation.ScheduleCalculator)1 Installment (org.mifos.accounts.loan.schedule.domain.Installment)1 Schedule (org.mifos.accounts.loan.schedule.domain.Schedule)1