Search in sources :

Example 1 with StubMessageContext

use of org.mifos.ui.validation.StubMessageContext in project head by mifos.

the class ValidationExceptionMessageExtractorTest method testBadNumericResponseException.

private void testBadNumericResponseException(BadNumericResponseException e, String expectedMessage) {
    ValidationException parent = new ValidationException("Key");
    parent.addChildException(e);
    ValidationExceptionMessageExtractor extractor = new ValidationExceptionMessageExtractor();
    MessageContext context = new StubMessageContext();
    extractor.extract(context, parent);
    Message[] messages = context.getAllMessages();
    Assert.assertEquals(1, messages.length);
    Message m = messages[0];
    Assert.assertEquals(expectedMessage, m.getText());
}
Also used : ValidationException(org.mifos.platform.validations.ValidationException) Message(org.springframework.binding.message.Message) StubMessageContext(org.mifos.ui.validation.StubMessageContext) StubMessageContext(org.mifos.ui.validation.StubMessageContext) MessageContext(org.springframework.binding.message.MessageContext)

Aggregations

ValidationException (org.mifos.platform.validations.ValidationException)1 StubMessageContext (org.mifos.ui.validation.StubMessageContext)1 Message (org.springframework.binding.message.Message)1 MessageContext (org.springframework.binding.message.MessageContext)1