use of org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment in project head by mifos.
the class InstallmentFormatValidatorTest method shouldValidateVariableInstallmentScheduleForMissingDueDate.
@Test
public void shouldValidateVariableInstallmentScheduleForMissingDueDate() {
RepaymentScheduleInstallment installment = installmentBuilder.withInstallment(3).withPrincipal(new Money(rupeeCurrency, "499.9")).withInterest(new Money(rupeeCurrency, "22.1")).withFees(new Money(rupeeCurrency, "0.0")).withTotal("522.0").build();
assertForValidDueDate(installment, "3");
}
use of org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment in project head by mifos.
the class InstallmentFormatValidatorTest method shouldValidateVariableInstallmentScheduleForDueDateInvalidFormat.
@Test
public void shouldValidateVariableInstallmentScheduleForDueDateInvalidFormat() {
RepaymentScheduleInstallment installment = installmentBuilder.withInstallment(3).withDueDate("12/12/1912").withPrincipal(new Money(rupeeCurrency, "499.9")).withInterest(new Money(rupeeCurrency, "22.1")).withFees(new Money(rupeeCurrency, "0.0")).withTotal("522.0").build();
assertForValidDueDate(installment, "3");
}
use of org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment in project head by mifos.
the class InstallmentFormatValidatorTest method shouldValidateInstallmentScheduleForMissingTotalAmount.
@Test
public void shouldValidateInstallmentScheduleForMissingTotalAmount() {
RepaymentScheduleInstallment installment = installmentBuilder.withInstallment(3).withDueDate("30-Nov-2010").withPrincipal(new Money(rupeeCurrency, "499.9")).withInterest(new Money(rupeeCurrency, "22.1")).withFees(new Money(rupeeCurrency, "0.0")).withTotal("").build();
assertForValidTotalAmount(installment, "3");
}
use of org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment in project head by mifos.
the class InstallmentRulesValidatorTest method shouldValidateInstallmentForDueDateSameAsDisburseDate.
@Test
public void shouldValidateInstallmentForDueDateSameAsDisburseDate() {
RepaymentScheduleInstallment installment = installmentBuilder.withInstallment(3).withDueDateValue("30-Nov-2010").withPrincipal(new Money(rupee, "499.9")).withInterest(new Money(rupee, "22.1")).withFees(new Money(rupee, "0.0")).withTotal("522.0").build();
Date dateValue = getDate(installment, "30-Nov-2010");
List<ErrorEntry> errorEntries = installmentRulesValidator.validateForDisbursementDate(asList(installment), dateValue);
assertErrorEntry(errorEntries.get(0), AccountConstants.INSTALLMENT_DUEDATE_SAME_AS_DISBURSE_DATE, "3");
}
use of org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment in project head by mifos.
the class InstallmentRulesValidatorTest method shouldNotValidateForValidVariableInstallments.
@Test
public void shouldNotValidateForValidVariableInstallments() {
RepaymentScheduleInstallment installment1 = installmentBuilder.reset(locale).withInstallment(1).withPrincipal(new Money(rupee, "49")).withTotalValue("50").withDueDateValue("01-Nov-2010").build();
RepaymentScheduleInstallment installment2 = installmentBuilder.reset(locale).withInstallment(2).withPrincipal(new Money(rupee, "49")).withTotalValue("50").withDueDateValue("03-Nov-2010").build();
RepaymentScheduleInstallment installment3 = installmentBuilder.reset(locale).withInstallment(3).withPrincipal(new Money(rupee, "49")).withTotalValue("50").withDueDateValue("06-Nov-2010").build();
VariableInstallmentDetailsBO variableInstallmentDetails = getVariableInstallmentDetails(2, 5, 50, rupee);
List<RepaymentScheduleInstallment> installments = asList(installment1, installment2, installment3);
Date disbursementDate = getDate(installment1, "27-Oct-2010");
List<ErrorEntry> errorEntries = installmentRulesValidator.validateDueDatesForVariableInstallments(installments, variableInstallmentDetails, disbursementDate);
assertThat(errorEntries.isEmpty(), is(true));
}
Aggregations