Class MockMessageHandler

All Implemented Interfaces:
org.reactivestreams.Subscriber<Message<?>>, Aware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, ApplicationContextAware, Ordered, ExpressionCapable, Orderable, MessageProducer, HeaderPropagationAware, IntegrationPattern, NamedComponent, IntegrationManagement, TrackableComponent, MessageHandler, reactor.core.CoreSubscriber<Message<?>>

public class MockMessageHandler
extends AbstractMessageProducingHandler
The AbstractMessageProducingHandler extension for the mocking purpose in tests.

The provided Consumers and Functions are applied to the incoming messages one at a time until the last, which is applied for all subsequent messages. The similar behavior exists in the Mockito.doReturn(Object toBeReturned, Object... toBeReturnedNext).

Typically is used as a chain of stub actions:

 
      MockIntegration.mockMessageHandler()
               .handleNext(...)
               .handleNext(...)
               .handleNextAndReply(...)
               .handleNextAndReply(...)
               .handleNext(...)
               .handleNextAndReply(...);
 
 
Since:
5.0
Author:
Artem Bilan