private MessagingMessageListenerAdapter createInstance( DefaultMessageHandlerMethodFactory factory, Method method, MessageListenerContainer container) { MethodRabbitListenerEndpoint endpoint = new MethodRabbitListenerEndpoint(); endpoint.setBean(sample); endpoint.setMethod(method); endpoint.setMessageHandlerMethodFactory(factory); return endpoint.createMessageListener(container); }
@Test public void createMessageListenerNoFactory() { MethodRabbitListenerEndpoint endpoint = new MethodRabbitListenerEndpoint(); endpoint.setBean(this); endpoint.setMethod(getTestMethod()); thrown.expect(IllegalStateException.class); endpoint.createMessageListener(container); }
@Test public void createMessageListener() { MethodRabbitListenerEndpoint endpoint = new MethodRabbitListenerEndpoint(); endpoint.setBean(this); endpoint.setMethod(getTestMethod()); endpoint.setMessageHandlerMethodFactory(factory); assertNotNull(endpoint.createMessageListener(container)); }