use of org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory in project spring-framework by spring-projects.
the class MethodJmsListenerEndpointTests method validatePayloadValid.
@Test
public void validatePayloadValid() throws JMSException {
String methodName = "validatePayload";
DefaultMessageHandlerMethodFactory customFactory = new DefaultMessageHandlerMethodFactory();
customFactory.setValidator(testValidator("invalid value"));
initializeFactory(customFactory);
Method method = getListenerMethod(methodName, String.class);
MessagingMessageListenerAdapter listener = createInstance(customFactory, method);
Session session = mock(Session.class);
// test is a valid value
listener.onMessage(createSimpleJmsTextMessage("test"), session);
assertListenerMethodInvocation(sample, methodName);
}
use of org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory in project spring-framework by spring-projects.
the class MethodJmsListenerEndpointTests method validatePayloadInvalid.
@Test
public void validatePayloadInvalid() throws JMSException {
DefaultMessageHandlerMethodFactory customFactory = new DefaultMessageHandlerMethodFactory();
customFactory.setValidator(testValidator("invalid value"));
Method method = getListenerMethod("validatePayload", String.class);
MessagingMessageListenerAdapter listener = createInstance(customFactory, method);
Session session = mock(Session.class);
thrown.expect(ListenerExecutionFailedException.class);
// test is an invalid value
listener.onMessage(createSimpleJmsTextMessage("invalid value"), session);
}
Aggregations