Package kalix.javasdk.testkit
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 Summary
Modifier and TypeMethodDescriptionclear()
Clear the destination so any existing messages are not considered on subsequent expect call.expectN()
Waits for a default amount of time before returning all unread messages.expectN
(int total) Waits for a given amount of unread messages to be received before returning.Waits for a given amount of unread messages to be received before returning up to a given timeout.void
Waits for predefined amount of time (seeOutgoingMessagesImpl.DefaultTimeout()
for default value).void
expectNone
(Duration timeout) Waits for given amount of time.Waits for predefined amount of time (seeOutgoingMessagesImpl.DefaultTimeout()
for default value) and returns the next unread message.Waits for a specific amount and returns the next unread message.EventingTestKit.Message
<com.google.protobuf.ByteString> Waits and returns the next unread message.EventingTestKit.Message
<com.google.protobuf.ByteString> expectOneRaw
(Duration timeout) Waits and returns the next unread message.<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.<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.
-
Method Details
-
expectNone
void expectNone()Waits for predefined amount of time (seeOutgoingMessagesImpl.DefaultTimeout()
for default value). If a message arrives in the meantime or has arrived before but was not consumed, the test fails. -
expectNone
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
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 (seeOutgoingMessagesImpl.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
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
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
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
List<EventingTestKit.Message<?>> 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
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
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 returningtimeout
- maximum amount of time to wait for the messages- Returns:
- list of messages, each message including the deserialized payload object and metadata
-
clear
List<EventingTestKit.Message<?>> 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.
-