use of org.mifos.accounts.loan.business.matchers.LoanScheduleEntityMatcher in project head by mifos.
the class ScheduleMapperTest method shouldMapScheduleToLoanScheduleEntity.
@Test
public void shouldMapScheduleToLoanScheduleEntity() throws PersistenceException {
AccountPaymentEntity accountPaymentEntity = new AccountPaymentEntity(loanBO, null, null, null, null, null);
LoanScheduleEntity scheduleEntityForPopulateTestInput = getLoanScheduleEntityForPopulateTestInput();
Set<LoanScheduleEntity> loanScheduleEntities = new LinkedHashSet<LoanScheduleEntity>();
loanScheduleEntities.add(scheduleEntityForPopulateTestInput);
when(loanBO.getLoanScheduleEntities()).thenReturn(loanScheduleEntities);
when(loanBO.getlegacyLoanDao()).thenReturn(legacyLoanDao);
Date paymentDate = getDate(24, 11, 2010);
Schedule schedule = getScheduleWithSingleInstallment();
scheduleMapper.populatePaymentDetails(schedule, loanBO, paymentDate, personnelBO, accountPaymentEntity);
assertCalculatedInterestOnPayment(accountPaymentEntity);
assertThat(getLoanScheduleEntity(paymentDate), new LoanScheduleEntityMatcher(scheduleEntityForPopulateTestInput));
verify(loanBO, times(1)).getLoanScheduleEntities();
verify(loanBO, times(1)).getlegacyLoanDao();
verify(loanBO, times(1)).recordSummaryAndPerfHistory(anyBoolean(), Matchers.<PaymentAllocation>any());
}
Aggregations