Interface EventingTestKit.OutgoingMessages

Enclosing interface:
EventingTestKit

public static interface EventingTestKit.OutgoingMessages
Allows to assert published messages for the purposes of testing outgoing message flow.
  • Method Details

    • expectNone

      void expectNone()
      Waits for predefined amount of time (see OutgoingMessagesImpl.DefaultTimeout() for default value). If a message arrives in the meantime or has arrived before but was not consumed, the test fails.
    • expectNone

      void expectNone(Duration timeout)
      Waits for given amount of time. If a message arrives in the meantime or has arrived before but was not consumed, the test fails.
      Parameters:
      timeout - amount of time to wait for a message
    • expectOneRaw

      EventingTestKit.Message<com.google.protobuf.ByteString> expectOneRaw()
      Waits and returns the next unread message. Note the message might have been received before this method was called. If no message is received, a timeout exception is thrown.
      Returns:
      a Message with a ByteString payload
    • expectOneRaw

      EventingTestKit.Message<com.google.protobuf.ByteString> expectOneRaw(Duration timeout)
      Waits and returns the next unread message. Note the message might have been received before this method was called. If no message is received, a timeout exception is thrown.
      Parameters:
      timeout - amount of time to wait for a message
      Returns:
      a Message with a ByteString payload
    • expectOne

      EventingTestKit.Message<?> expectOne()
      Waits for predefined amount of time (see OutgoingMessagesImpl.DefaultTimeout() for default value) and returns the next unread message. Note the message might have been received before this method was called. If no message is received, a timeout exception is thrown.
      Returns:
      message including ByteString payload and metadata
    • expectOne

      EventingTestKit.Message<?> expectOne(Duration timeout)
      Waits for a specific amount and returns the next unread message. Note the message might have been received before this method was called. If no message is received, a timeout exception is thrown.
      Parameters:
      timeout - amount of time to wait for a message if it was not received already
      Returns:
      message including ByteString payload and metadata
    • expectOneTyped

      <T> EventingTestKit.Message<T> expectOneTyped(Class<T> instance)
      Waits and returns the next unread message and automatically parses and casts it to the specified given type.
      Type Parameters:
      T - a given domain type
      Parameters:
      instance - class type to cast the received message bytes to
      Returns:
      a Message of type T
    • expectOneTyped

      <T> EventingTestKit.Message<T> expectOneTyped(Class<T> instance, Duration timeout)
      Waits and returns the next unread message and automatically parses and casts it to the specified given type. Note the message might have been received before this method was called. If no message is received, a timeout exception is thrown.
      Parameters:
      timeout - amount of time to wait for a message if it was not received already
      Returns:
      message including ByteString payload and metadata
    • expectN

      Waits for a default amount of time before returning all unread messages. If no message is received, a timeout exception is thrown.
      Returns:
      list of messages, each message including the deserialized payload object and metadata
    • expectN

      List<EventingTestKit.Message<?>> expectN(int total)
      Waits for a given amount of unread messages to be received before returning. If no message is received, a timeout exception is thrown.
      Parameters:
      total - number of messages to wait for before returning
      Returns:
      list of messages, each message including the deserialized payload object and metadata
    • expectN

      List<EventingTestKit.Message<?>> expectN(int total, Duration timeout)
      Waits for a given amount of unread messages to be received before returning up to a given timeout. If no message is received, a timeout exception is thrown.
      Parameters:
      total - number of messages to wait for before returning
      timeout - maximum amount of time to wait for the messages
      Returns:
      list of messages, each message including the deserialized payload object and metadata
    • clear

      Clear the destination so any existing messages are not considered on subsequent expect call.
      Returns:
      the list of the unread messages when the destination was cleared.