use of org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment in project head by mifos.
the class LoanServiceFacadeWebTierTest method shouldValidateForInstallmentDateBeyondCashFlowData.
@Ignore
@Test
public void shouldValidateForInstallmentDateBeyondCashFlowData() {
ArrayList<MonthlyCashFlowDetail> monthlyCashFlows = new ArrayList<MonthlyCashFlowDetail>();
DateTime dateTime = new DateTime().withDate(2010, 10, 30);
monthlyCashFlows.add(new MonthlyCashFlowDetail(dateTime, new BigDecimal(123), new BigDecimal(234), ""));
monthlyCashFlows.add(new MonthlyCashFlowDetail(dateTime.plusMonths(1), new BigDecimal(123), new BigDecimal(234), ""));
monthlyCashFlows.add(new MonthlyCashFlowDetail(dateTime.plusMonths(2), new BigDecimal(123), new BigDecimal(234), ""));
CashFlowDetail cashFlowDetail = new CashFlowDetail(monthlyCashFlows);
CashFlowForm cashFlowForm = new CashFlowForm(cashFlowDetail, false, new BigDecimal(1000), 10d);
cashFlowForm.setTotalExpenses(BigDecimal.valueOf(76));
cashFlowForm.setTotalRevenues(BigDecimal.valueOf(55));
RepaymentScheduleInstallment installment = installmentBuilder.reset(locale).withPrincipal(new Money(rupee, "4.9")).withTotalValue("10").withDueDateValue("30-Nov-2010").build();
RepaymentScheduleInstallment installmentBeforeCashFlowDate = installmentBuilder.reset(locale).withPrincipal(new Money(rupee, "4.9")).withTotalValue("10").withDueDateValue("30-Nov-2010").build();
List<RepaymentScheduleInstallment> installments = asList(installment);
Errors errors;
// errors = loanServiceFacade.validateCashFlowForInstallments(installments, cashFlowForm, 1600d);
// assertThat(errors.hasErrorEntryWithCode(AccountConstants.INSTALLMENT_BEYOND_CASHFLOW_DATE), is(false));
RepaymentScheduleInstallment installmentBeyondCashFlowDate = installmentBuilder.reset(locale).withPrincipal(new Money(rupee, "4.9")).withTotalValue("10").withDueDateValue("30-Jan-2011").build();
installments = asList(installmentBeyondCashFlowDate);
// errors = loanServiceFacade.validateCashFlowForInstallments(installments, cashFlowForm, 1600d);
// assertThat(errors.hasErrorEntryWithCode(AccountConstants.INSTALLMENT_BEYOND_CASHFLOW_DATE), is(true));
// errors = loanServiceFacade.validateCashFlowForInstallments(installments, cashFlowForm, 1700d);
// assertThat(errors.hasErrorEntryWithCode(AccountConstants.INSTALLMENT_BEYOND_CASHFLOW_DATE), is(true));
}
Aggregations