Search in sources :

Example 66 with RepaymentScheduleInstallment

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));
}
Also used : Money(org.mifos.framework.util.helpers.Money) Errors(org.mifos.platform.validations.Errors) MonthlyCashFlowDetail(org.mifos.platform.cashflow.service.MonthlyCashFlowDetail) CashFlowDetail(org.mifos.platform.cashflow.service.CashFlowDetail) RepaymentScheduleInstallment(org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment) ArrayList(java.util.ArrayList) CashFlowForm(org.mifos.platform.cashflow.ui.model.CashFlowForm) MonthlyCashFlowDetail(org.mifos.platform.cashflow.service.MonthlyCashFlowDetail) DateTime(org.joda.time.DateTime) BigDecimal(java.math.BigDecimal) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

RepaymentScheduleInstallment (org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment)66 Test (org.junit.Test)44 Money (org.mifos.framework.util.helpers.Money)34 Date (java.util.Date)27 ArrayList (java.util.ArrayList)19 ErrorEntry (org.mifos.platform.validations.ErrorEntry)19 LoanBO (org.mifos.accounts.loan.business.LoanBO)7 VariableInstallmentDetailsBO (org.mifos.accounts.productdefinition.business.VariableInstallmentDetailsBO)7 OriginalScheduleInfoDto (org.mifos.accounts.loan.business.service.OriginalScheduleInfoDto)6 LoanAccountActionForm (org.mifos.accounts.loan.struts.actionforms.LoanAccountActionForm)6 Errors (org.mifos.platform.validations.Errors)6 MifosCurrency (org.mifos.application.master.business.MifosCurrency)5 MifosRuntimeException (org.mifos.core.MifosRuntimeException)5 BigDecimal (java.math.BigDecimal)4 ActionErrors (org.apache.struts.action.ActionErrors)4 Ignore (org.junit.Ignore)4 HashSet (java.util.HashSet)3 LocalDate (org.joda.time.LocalDate)3 OriginalLoanScheduleEntity (org.mifos.accounts.loan.business.OriginalLoanScheduleEntity)3 MessageLookup (org.mifos.application.master.MessageLookup)3