use of org.mifos.accounts.savings.business.SavingsScheduleEntity in project head by mifos.
the class SavingsScheduleIntegrationTest method createWeeklySavingScheduleSecondInstallmentFallsInNextWorkingDayHoliday.
@Ignore
@Test
public void createWeeklySavingScheduleSecondInstallmentFallsInNextWorkingDayHoliday() throws Exception {
// One-day holiday on the second deposit date, Monday
buildAndPersistHoliday(expectedFirstDepositDate.plusWeeks(1), expectedFirstDepositDate.plusWeeks(1), RepaymentRuleTypes.NEXT_WORKING_DAY);
createClientSavingsAccount();
short installmentId = 1;
DateTime installmentDate = expectedFirstDepositDate;
for (AccountActionDateEntity accountActionDate : getActionDatesSortedByDate(savingsAccount)) {
SavingsScheduleEntity scheduleEntity = (SavingsScheduleEntity) accountActionDate;
assertThat(scheduleEntity.getInstallmentId(), is(installmentId));
if (installmentId == 2) {
assertThat(new LocalDate(scheduleEntity.getActionDate()), //Tuesday after holiday
is(new LocalDate(installmentDate.plusDays(1).toDate())));
} else {
assertThat(new LocalDate(scheduleEntity.getActionDate()), is(new LocalDate(installmentDate.toDate())));
}
assertThat(scheduleEntity.getDeposit().getAmountDoubleValue(), is(13.0));
installmentId++;
installmentDate = installmentDate.plusWeeks(1);
}
}
use of org.mifos.accounts.savings.business.SavingsScheduleEntity in project head by mifos.
the class SavingsScheduleIntegrationTest method createWeeklySavingScheduleSecondInstallmentFallsInMoratorium.
@Ignore
@Test
public void createWeeklySavingScheduleSecondInstallmentFallsInMoratorium() throws Exception {
buildAndPersistHoliday(expectedFirstDepositDate.plusWeeks(1), expectedFirstDepositDate.plusWeeks(1), RepaymentRuleTypes.REPAYMENT_MORATORIUM);
createClientSavingsAccount();
short installmentId = 1;
DateTime installmentDate = expectedFirstDepositDate;
for (AccountActionDateEntity accountActionDate : getActionDatesSortedByDate(savingsAccount)) {
SavingsScheduleEntity scheduleEntity = (SavingsScheduleEntity) accountActionDate;
assertThat(scheduleEntity.getInstallmentId(), is(installmentId));
if (installmentId < 2) {
assertThat(new LocalDate(scheduleEntity.getActionDate()), is(new LocalDate(installmentDate.toDate())));
} else {
// second and following dates pushed out one week.
assertThat(new LocalDate(scheduleEntity.getActionDate()), is(new LocalDate(installmentDate.plusWeeks(1).toDate())));
}
assertThat(scheduleEntity.getDeposit().getAmountDoubleValue(), is(13.0));
installmentId++;
installmentDate = installmentDate.plusWeeks(1);
}
}
use of org.mifos.accounts.savings.business.SavingsScheduleEntity in project head by mifos.
the class SavingsBOIntegrationTest method testGetTotalAmountDueForCenter.
@Test
public void testGetTotalAmountDueForCenter() throws Exception {
savings = getSavingsAccountForCenter();
Money dueAmount = new Money(getCurrency());
for (AccountActionDateEntity actionDate : savings.getAccountActionDates()) {
dueAmount = dueAmount.add(((SavingsScheduleEntity) actionDate).getDeposit());
break;
}
dueAmount = dueAmount.add(dueAmount);
Assert.assertEquals(dueAmount, savings.getTotalAmountDue());
}
use of org.mifos.accounts.savings.business.SavingsScheduleEntity in project head by mifos.
the class SavingsBOIntegrationTest method testGetTotalAmountDueForTwoInstallmentsDue.
@Test
public void testGetTotalAmountDueForTwoInstallmentsDue() throws Exception {
savings = getSavingsAccount();
AccountActionDateEntity accountActionDateEntity = savings.getAccountActionDate((short) 1);
((SavingsScheduleEntity) accountActionDateEntity).setActionDate(offSetCurrentDate(2));
AccountActionDateEntity accountActionDateEntity2 = savings.getAccountActionDate((short) 2);
((SavingsScheduleEntity) accountActionDateEntity2).setActionDate(offSetCurrentDate(1));
savings = (SavingsBO) saveAndFetch(savings);
Assert.assertEquals(savings.getTotalAmountInArrears(), TestUtils.createMoney(400.0));
}
use of org.mifos.accounts.savings.business.SavingsScheduleEntity in project head by mifos.
the class SavingsBOIntegrationTest method testGetTotalAmountDueForTwoInstallments.
@Test
public void testGetTotalAmountDueForTwoInstallments() throws Exception {
savings = getSavingsAccount();
AccountActionDateEntity accountActionDateEntity = savings.getAccountActionDate((short) 1);
((SavingsScheduleEntity) accountActionDateEntity).setActionDate(offSetCurrentDate(2));
AccountActionDateEntity accountActionDateEntity2 = savings.getAccountActionDate((short) 2);
((SavingsScheduleEntity) accountActionDateEntity2).setActionDate(offSetCurrentDate(1));
savings = (SavingsBO) saveAndFetch(savings);
Assert.assertEquals(savings.getTotalAmountDue(), TestUtils.createMoney(600.0));
}
Aggregations