use of org.mifos.platform.validation.MifosBeanValidator in project head by mifos.
the class LoanAccountFormBeanTest method setUp.
@Before
public void setUp() {
MifosBeanValidator validator = new MifosBeanValidator();
LocalValidatorFactoryBean targetValidator = new LocalValidatorFactoryBean();
targetValidator.afterPropertiesSet();
validator.setTargetValidator(targetValidator);
loanAccountFormBean = new LoanAccountFormBean();
Integer productId = Integer.valueOf(1);
Integer customerId = Integer.valueOf(1);
loanAccountFormBean.setProductId(productId);
loanAccountFormBean.setCustomerId(customerId);
loanAccountFormBean.setPurposeOfLoanMandatory(false);
loanAccountFormBean.setSourceOfFundsMandatory(false);
loanAccountFormBean.setExternalIdMandatory(false);
loanAccountFormBean.setCollateralTypeAndNotesHidden(false);
loanAccountFormBean.setAmount(Double.valueOf("1000.0"));
loanAccountFormBean.setMinAllowedAmount(Integer.valueOf(400));
loanAccountFormBean.setMaxAllowedAmount(Integer.valueOf(20000));
loanAccountFormBean.setInterestRate(Double.valueOf(10.0));
loanAccountFormBean.setMinAllowedInterestRate(Double.valueOf(1.0));
loanAccountFormBean.setMaxAllowedInterestRate(Double.valueOf(20.0));
loanAccountFormBean.setDigitsBeforeDecimalForInterest(10);
loanAccountFormBean.setDigitsAfterDecimalForInterest(5);
loanAccountFormBean.setDigitsBeforeDecimalForMonetaryAmounts(14);
loanAccountFormBean.setDigitsAfterDecimalForMonetaryAmounts(1);
loanAccountFormBean.setAdditionalFees(createAdditionalFeesMocks());
loanAccountFormBean.setDisbursementDateDD(24);
loanAccountFormBean.setDisbursementDateMM(02);
loanAccountFormBean.setDisbursementDateYY(2011);
loanAccountFormBean.setNumberOfInstallments(12);
loanAccountFormBean.setMinNumberOfInstallments(1);
loanAccountFormBean.setMaxNumberOfInstallments(12);
loanAccountFormBean.setValidator(validator);
loanAccountFormBean.setLoanDisbursementDateValidationServiceFacade(loanDisbursementDateValidationServiceFacade);
context = new StubValidationContext();
when(loanDisbursementDateValidationServiceFacade.validateLoanDisbursementDate((LocalDate) anyObject(), anyInt(), anyInt())).thenReturn(new Errors());
}
use of org.mifos.platform.validation.MifosBeanValidator in project head by mifos.
the class CreateSavingsAccountFormBeanTest method setUp.
@Before
public void setUp() {
MifosBeanValidator validator = new MifosBeanValidator();
LocalValidatorFactoryBean targetValidator = new LocalValidatorFactoryBean();
targetValidator.afterPropertiesSet();
validator.setTargetValidator(targetValidator);
formBean = new CreateSavingsAccountFormBean();
formBean.setValidator(validator);
questionnaireServiceFacade = mock(QuestionnaireServiceFacade.class);
formBean.setQuestionnaireServiceFascade(questionnaireServiceFacade);
configurationDto = new AccountingConfigurationDto();
configurationDto.setDigitsBeforeDecimal((short) 14);
configurationDto.setDigitsAfterDecimal((short) 1);
configurationServiceFacade = mock(ConfigurationServiceFacade.class);
when(configurationServiceFacade.getAccountingConfiguration()).thenReturn(configurationDto);
formBean.setConfigurationServiceFacade(configurationServiceFacade);
validationContext = new StubValidationContext();
validationException = new ValidationException("Root");
validationException.addChildException(new ValidationException("Child"));
}
Aggregations