クラス MockMessageHandler

実装されたすべてのインターフェース:
org.reactivestreams.Subscriber<Message<?>>AwareBeanFactoryAwareBeanNameAwareDisposableBeanInitializingBeanApplicationContextAwareOrderedComponentSourceAwareExpressionCapableOrderableMessageProducerHeaderPropagationAwareIntegrationPatternNamedComponentIntegrationManagementTrackableComponentMessageHandlerreactor.core.CoreSubscriber<Message<?>>

public class MockMessageHandler extends AbstractMessageProducingHandler
テストでのモック用の AbstractMessageProducingHandler 拡張。

提供された ConsumerSE および FunctionSE は、最後のメッセージまで一度に 1 つずつ受信メッセージに適用され、後続のすべてのメッセージに適用されます。同様の動作が Mockito.doReturn(Object toBeReturned, Object... toBeReturnedNext) に存在します。

通常、スタブアクションのチェーンとして使用されます。

 
      MockIntegration.mockMessageHandler()
               .handleNext(...)
               .handleNext(...)
               .handleNextAndReply(...)
               .handleNextAndReply(...)
               .handleNext(...)
               .handleNextAndReply(...);
 
 
導入:
5.0
作成者:
Artem Bilan, Christian Tzolov
  • フィールドの詳細

  • コンストラクターの詳細

    • MockMessageHandler

      protected MockMessageHandler(org.mockito.ArgumentCaptor<Message<?>> messageArgumentCaptor)
  • メソッドの詳細

    • handleNext

      public MockMessageHandler handleNext(ConsumerSE<Message<?>> nextMessageConsumer)
      ConsumerSE をスタックに追加して、次の受信メッセージを処理します。
      パラメーター:
      nextMessageConsumer - 次の受信メッセージを処理するコンシューマー。
      戻り値:
      this
    • handleNextAndReply

      public MockMessageHandler handleNextAndReply(FunctionSE<Message<?>,?> nextMessageFunction)
      FunctionSE をスタックに追加して、次の受信メッセージを処理し、それに対する応答を生成します。
      パラメーター:
      nextMessageFunction - 次の受信メッセージを処理する関数。
      戻り値:
      this
    • handleMessageInternal

      protected void handleMessageInternal(Message<?> message)
      次で指定:
      クラス AbstractMessageHandlerhandleMessageInternal