Class MockIntegration

java.lang.Object
org.springframework.integration.test.mock.MockIntegration

public final class MockIntegration extends Object
The factory for integration specific mock components.
Since:
5.0
Author:
Artem Bilan
  • Method Details

    • mockMessageSource

      public static <T> MessageSource<T> mockMessageSource(T payload)
      Build a mock for the MessageSource based on the provided payload. The returned instance is ordinary Mockito mock that is capable of recording interactions with it and further verification.
      Type Parameters:
      T - the payload type
      Parameters:
      payload - the payload to return by mocked MessageSource
      Returns:
      the mocked MessageSource
      See Also:
      • Mockito.mock(Class)
    • mockMessageSource

      public static <T> MessageSource<T> mockMessageSource(T payload, T... payloads)
      Build a mock for the MessageSource based on the provided payloads. The returned instance is ordinary Mockito mock that is capable of recording interactions with it and further verification.
      Type Parameters:
      T - the payload type
      Parameters:
      payload - the first payload to return by mocked MessageSource
      payloads - the next payloads to return by mocked MessageSource
      Returns:
      the mocked MessageSource
      See Also:
      • Mockito.mock(Class)
    • mockMessageSource

      public static MessageSource<?> mockMessageSource(Message<?> message)
      Build a mock for the MessageSource based on the provided message. The returned instance is ordinary Mockito mock that is capable of recording interactions with it and further verification.
      Parameters:
      message - the message to return by mocked MessageSource
      Returns:
      the mocked MessageSource
      See Also:
      • Mockito.mock(Class)
    • mockMessageSource

      public static MessageSource<?> mockMessageSource(Message<?> message, Message<?>... messages)
      Build a mock for the MessageSource based on the provided messages. The returned instance is ordinary Mockito mock that is capable of recording interactions with it and further verification.
      Parameters:
      message - the first message to return by mocked MessageSource
      messages - the next messages to return by mocked MessageSource
      Returns:
      the mocked MessageSource
      See Also:
      • Mockito.mock(Class)
    • mockMessageHandler

      public static MockMessageHandler mockMessageHandler()
      Build a MockMessageHandler instance.
      Returns:
      the MockMessageHandler instance ready for interaction
    • mockMessageHandler

      public static MockMessageHandler mockMessageHandler(org.mockito.ArgumentCaptor<Message<?>> messageArgumentCaptor)
      Build a MockMessageHandler instance based on the provided ArgumentCaptor.
      Parameters:
      messageArgumentCaptor - the Mockito ArgumentCaptor to capture incoming messages
      Returns:
      the MockMessageHandler instance ready for interaction
    • messageArgumentCaptor

      public static org.mockito.ArgumentCaptor<Message<?>> messageArgumentCaptor()