Search in sources :

Example 1 with LoanScheduleEntityMatcher

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());
}
Also used : LinkedHashSet(java.util.LinkedHashSet) LoanScheduleEntityMatcher(org.mifos.accounts.loan.business.matchers.LoanScheduleEntityMatcher) Schedule(org.mifos.accounts.loan.schedule.domain.Schedule) AccountPaymentEntity(org.mifos.accounts.business.AccountPaymentEntity) Date(java.util.Date) TestUtils.getDate(org.mifos.framework.TestUtils.getDate) Test(org.junit.Test)

Aggregations

Date (java.util.Date)1 LinkedHashSet (java.util.LinkedHashSet)1 Test (org.junit.Test)1 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)1 LoanScheduleEntityMatcher (org.mifos.accounts.loan.business.matchers.LoanScheduleEntityMatcher)1 Schedule (org.mifos.accounts.loan.schedule.domain.Schedule)1 TestUtils.getDate (org.mifos.framework.TestUtils.getDate)1