use of org.springframework.binding.message.MessageContext in project head by mifos.
the class CustomerSearchFormBean method validateCustomerSearchStep.
/**
* Validation method that Spring webflow calls on state transition out of
* customerSearchStep.
*/
public void validateCustomerSearchStep(ValidationContext context) {
MessageContext messages = context.getMessageContext();
validator.validate(this, messages);
}
use of org.springframework.binding.message.MessageContext in project head by mifos.
the class CustomizedTextSelectFormBean method validateSelectCustomizedTextStep.
/**
* Validation method that Spring webflow calls on state transition out of
* customerSearchStep.
*/
public void validateSelectCustomizedTextStep(ValidationContext context) {
MessageContext messages = context.getMessageContext();
if (context.getUserEvent().equals("add")) {
return;
}
validator.validate(this, messages);
}
use of org.springframework.binding.message.MessageContext in project head by mifos.
the class LoanAccountFormBeanTest method shouldContainValidationMessageOnSourceOfFundsFieldWhenFieldIsMandatoryAndNotSelected.
@Test
public void shouldContainValidationMessageOnSourceOfFundsFieldWhenFieldIsMandatoryAndNotSelected() {
// setup
loanAccountFormBean.setSourceOfFundsMandatory(true);
loanAccountFormBean.setFundId(null);
// exercise test
loanAccountFormBean.validateEnterAccountDetailsStep(context);
// verification
MessageContext messageContext = context.getMessageContext();
Message[] messages = messageContext.getAllMessages();
assertThat(messages.length, is(1));
Message message = messages[0];
assertThat(message.getSource().toString(), is("fundId"));
assertThat(message.getText().toString(), containsString("loanAccountFormBean.SourceOfFunds.invalid"));
}
use of org.springframework.binding.message.MessageContext in project head by mifos.
the class CreateSavingsAccountFormBeanTest method validateCustomerSearchStepEmptySearchStringShouldFail.
@Test
public void validateCustomerSearchStepEmptySearchStringShouldFail() {
formBean.validateCustomerSearchStep(validationContext);
MessageContext messageContext = validationContext.getMessageContext();
Message[] messages = messageContext.getAllMessages();
Assert.assertEquals(1, messages.length);
Message message = messages[0];
Assert.assertEquals("searchString", message.getSource());
verifyErrorMessage(NotEmpty.class, message);
}
use of org.springframework.binding.message.MessageContext in project head by mifos.
the class CreateSavingsAccountFormBeanTest method validateAnswerQuestionGroupStepMissingMandatoryResponseShouldFail.
@Test
public void validateAnswerQuestionGroupStepMissingMandatoryResponseShouldFail() {
List<QuestionGroupDetail> questionGroups = new ArrayList<QuestionGroupDetail>();
formBean.setQuestionGroups(questionGroups);
doThrow(validationException).when(questionnaireServiceFacade).validateResponses(formBean.getQuestionGroups());
formBean.validateAnswerQuestionGroupStep(validationContext);
MessageContext messageContext = validationContext.getMessageContext();
Message[] messages = messageContext.getAllMessages();
Assert.assertEquals(1, messages.length);
}
Aggregations