use of org.mifos.platform.validations.Errors in project head by mifos.
the class LoanAccountServiceFacadeWebTier method validateCashFlowForInstallmentsForWarnings.
@Override
public Errors validateCashFlowForInstallmentsForWarnings(List<CashFlowDataDto> cashFlowDataDtos, Integer productId) {
Errors errors = new Errors();
LoanOfferingBO loanOfferingBO = this.loanProductDao.findById(productId);
if (loanOfferingBO.shouldValidateCashFlowForInstallments()) {
CashFlowDetail cashFlowDetail = loanOfferingBO.getCashFlowDetail();
if (CollectionUtils.isNotEmpty(cashFlowDataDtos)) {
for (CashFlowDataDto cashflowDataDto : cashFlowDataDtos) {
validateCashFlow(errors, cashFlowDetail.getCashFlowThreshold(), cashflowDataDto);
}
}
}
return errors;
}
use of org.mifos.platform.validations.Errors in project head by mifos.
the class LoanAccountActionTest method getLoanRepaymentScheduleShouldValidateViewDate.
@Test
public void getLoanRepaymentScheduleShouldValidateViewDate() throws Exception {
ActionForward getLoanScheduleFailure = new ActionForward("getLoanRepaymentScheduleFailure");
java.sql.Date extraInterestDate = TestUtils.getSqlDate(10, 7, 2010);
Errors errors = new Errors();
errors.addError(LoanConstants.CANNOT_VIEW_REPAYMENT_SCHEDULE, new String[] { extraInterestDate.toString() });
when(loanBusinessService.computeExtraInterest(loanBO, extraInterestDate)).thenReturn(errors);
when(form.getScheduleViewDateValue(Locale.US)).thenReturn(extraInterestDate);
when(request.getParameter("accountId")).thenReturn("1");
when(mapping.findForward("getLoanRepaymentScheduleFailure")).thenReturn(getLoanScheduleFailure);
when(loanServiceFacade.retrieveOriginalLoanSchedule(Matchers.<Integer>any())).thenReturn(new OriginalScheduleInfoDto("100", new Date(), Collections.<RepaymentScheduleInstallment>emptyList()));
ActionForward forward = loanAccountAction.getLoanRepaymentSchedule(mapping, form, request, response);
assertThat(forward, is(getLoanScheduleFailure));
verify(form).resetScheduleViewDate();
}
use of org.mifos.platform.validations.Errors in project head by mifos.
the class LoanAccountServiceFacadeWebTierTest method shouldValidateInstallmentSchedule.
@Test
public void shouldValidateInstallmentSchedule() {
List<RepaymentScheduleInstallment> installments = new ArrayList<RepaymentScheduleInstallment>();
Errors expectedErrors = new Errors();
BigDecimal minInstallmentAmount = BigDecimal.ZERO;
when(installmentsValidator.validateInstallmentSchedule(installments, minInstallmentAmount)).thenReturn(expectedErrors);
Errors errors = loanAccountServiceFacade.validateInstallmentSchedule(new ArrayList<LoanCreationInstallmentDto>(), minInstallmentAmount);
assertThat(errors, is(expectedErrors));
verify(installmentsValidator).validateInstallmentSchedule(installments, minInstallmentAmount);
}
use of org.mifos.platform.validations.Errors in project head by mifos.
the class JdbcBranchCashConfirmationReportParameterFormTest method testShouldReportErrorIfBranchIdAndDateAreInvalid.
public void testShouldReportErrorIfBranchIdAndDateAreInvalid() throws Exception {
JdbcBranchCashConfirmationReportParameterForm form = new JdbcBranchCashConfirmationReportParameterForm("-2", "262008");
Errors errors = new Errors();
String branchInvalidErrorCode = getErrorCode(errors, ReportValidationConstants.BRANCH_ID_PARAM);
String dateInvalidErrorCode = getErrorCode(errors, ReportValidationConstants.RUN_DATE_PARAM_FOR_CASH_CONF_REPORT);
form.validate(errors);
Assert.assertTrue(errors.hasErrors());
Assert.assertEquals(ReportValidationConstants.BRANCH_ID_INVALID_MSG, branchInvalidErrorCode);
Assert.assertEquals(ReportValidationConstants.RUN_DATE_INVALID_MSG, dateInvalidErrorCode);
}
use of org.mifos.platform.validations.Errors in project head by mifos.
the class JdbcBranchCashConfirmationReportParameterFormTest method testShouldAcceptValidBranchIdAndDate.
public void testShouldAcceptValidBranchIdAndDate() {
JdbcBranchCashConfirmationReportParameterForm form = new JdbcBranchCashConfirmationReportParameterForm("1", "26/06/2008");
Errors errorsMock = createMock(Errors.class);
replay(errorsMock);
form.validate(errorsMock);
verify(errorsMock);
}
Aggregations