use of org.mifos.accounts.loan.schedule.domain.ScheduleMatcher in project head by mifos.
the class ScheduleCalculatorAdaptorTest method shouldComputeExtraInterestForDecliningPrincipalBalance.
@Test
public void shouldComputeExtraInterestForDecliningPrincipalBalance() {
Set<LoanScheduleEntity> loanScheduleEntities = getLoanScheduleEntities();
when(loanBO.isDecliningBalanceInterestRecalculation()).thenReturn(true);
when(loanBO.getLoanScheduleEntities()).thenReturn(loanScheduleEntities);
when(loanBO.getDisbursementDate()).thenReturn(DISBURSEMENT_DATE);
when(loanBO.getLoanAmount()).thenReturn(new Money(rupee, LOAN_AMOUNT));
when(loanBO.getInterestRate()).thenReturn(ANNUAL_INTEREST_RATE);
when(loanBO.getLoanScheduleEntityMap()).thenReturn(getLoanScheduleEntityMap(loanScheduleEntities));
scheduleCalculatorAdaptor.computeExtraInterest(loanBO, getDate(30, 10, 2010));
Schedule expectedSchedule = getSchedule(DISBURSEMENT_DATE, LOAN_AMOUNT, getInstallments(0, .46, 0));
verify(scheduleCalculator).computeExtraInterest(argThat(new ScheduleMatcher(expectedSchedule)), Mockito.eq(getDate(30, 10, 2010)));
verify(loanBO, times(1)).isDecliningBalanceInterestRecalculation();
verify(loanBO, times(1)).getLoanScheduleEntities();
verify(loanBO, times(1)).getDisbursementDate();
verify(loanBO, times(1)).getLoanAmount();
verify(loanBO, times(1)).getInterestRate();
verify(loanBO, times(1)).getLoanScheduleEntityMap();
ArrayList<LoanScheduleEntity> loanScheduleEntitiesWithExtraInterest = new ArrayList<LoanScheduleEntity>(loanBO.getLoanScheduleEntities());
assertExtraInterest(loanScheduleEntitiesWithExtraInterest.get(0), 0.0);
assertExtraInterest(loanScheduleEntitiesWithExtraInterest.get(1), 0.46);
assertExtraInterest(loanScheduleEntitiesWithExtraInterest.get(2), 0.0);
}
use of org.mifos.accounts.loan.schedule.domain.ScheduleMatcher in project head by mifos.
the class ScheduleMapperTest method shouldMapLoanScheduleEntityToSchedule.
@Test
public void shouldMapLoanScheduleEntityToSchedule() {
Collection<LoanScheduleEntity> loanScheduleEntities = getLoanScheduleEntities(getDate(24, 11, 2010));
Schedule schedule = scheduleMapper.mapToSchedule(loanScheduleEntities, DISBURSEMENT_DATE, DAILY_INTEREST_RATE, LOAN_AMOUNT);
assertThat(schedule, new ScheduleMatcher(getSchedule()));
}
Aggregations