Package org.camunda.community.bpmndt.api
Class MessageEventHandler
java.lang.Object
org.camunda.community.bpmndt.api.MessageEventHandler
Fluent API to handle message catch events. Please note: a message is correlated by default.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceInterface for custom actions that need to correlate a message. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCorrelates the message, when the process instance is waiting at the corresponding element, using specified variables.customize(Consumer<MessageEventHandler> customizer) Customizes the handler, using the givenConsumerfunction.voidCorrelates the message using a custom action, when the process instance is waiting at the corresponding element.Verifies the message event's waiting state.verifyCorrelationKey(String expectedCorrelationKey) Verifies that the message event has a specific correlation key.verifyCorrelationKey(Consumer<String> correlationKeyConsumer) Verifies that the message event has a specific correlation key, using a consumer.verifyCorrelationKeyExpression(Consumer<String> correlationKeyExpressionConsumer) Verifies that the message event has a specific correlation key FEEL expression (see "Message" section), using a consumer function.verifyMessageName(String expectedMessageName) Verifies that the message event has a specific message name.verifyMessageName(Consumer<String> messageNameConsumer) Verifies that the message event has a specific message name, using a consumer.verifyMessageNameExpression(Consumer<String> messageNameExpressionConsumer) Verifies that the message event has a specific message name FEEL expression (see "Message" section), using a consumer function.withVariable(String name, Object value) Sets a variable that is used to correlate the message.withVariableMap(Map<String, Object> variableMap) Sets variables that are used to correlate the message.withVariables(Object variables) Sets an object as variables that is used to correlate the message.
-
Constructor Details
-
MessageEventHandler
-
MessageEventHandler
-
-
Method Details
-
correlate
public void correlate()Correlates the message, when the process instance is waiting at the corresponding element, using specified variables.- See Also:
-
customize
Customizes the handler, using the givenConsumerfunction. This method can be used to apply a common customization needed for different test cases.tc.handleMessageCatchEvent().customize(this::prepare);
- Parameters:
customizer- A function that accepts aMessageEventHandler.- Returns:
- The handler.
-
execute
Correlates the message using a custom action, when the process instance is waiting at the corresponding element.- Parameters:
action- A specific action that implements theMessageEventHandler.Correlationor accepts aZeebeClient, the message name and the correlation key.- See Also:
-
verify
public MessageEventHandler verify(Consumer<io.camunda.zeebe.process.test.assertions.ProcessInstanceAssert> verifier) Verifies the message event's waiting state.- Parameters:
verifier- Verifier that accepts anProcessInstanceAssertinstance.- Returns:
- The handler.
-
verifyCorrelationKey
Verifies that the message event has a specific correlation key.- Parameters:
expectedCorrelationKey- The expected correlation key.- Returns:
- The handler.
-
verifyCorrelationKey
Verifies that the message event has a specific correlation key, using a consumer.- Parameters:
correlationKeyConsumer- A consumer asserting the correlation key.- Returns:
- The handler.
-
verifyCorrelationKeyExpression
public MessageEventHandler verifyCorrelationKeyExpression(Consumer<String> correlationKeyExpressionConsumer) Verifies that the message event has a specific correlation key FEEL expression (see "Message" section), using a consumer function.- Parameters:
correlationKeyExpressionConsumer- A consumer asserting the correlation key expression.- Returns:
- The handler.
-
verifyMessageName
Verifies that the message event has a specific message name.- Parameters:
expectedMessageName- The expected message name.- Returns:
- The handler.
-
verifyMessageName
Verifies that the message event has a specific message name, using a consumer.- Parameters:
messageNameConsumer- A consumer asserting the message name.- Returns:
- The handler.
-
verifyMessageNameExpression
public MessageEventHandler verifyMessageNameExpression(Consumer<String> messageNameExpressionConsumer) Verifies that the message event has a specific message name FEEL expression (see "Message" section), using a consumer function.- Parameters:
messageNameExpressionConsumer- A consumer asserting the message name expression.- Returns:
- The handler.
-
withVariable
Sets a variable that is used to correlate the message.- Parameters:
name- The name of the variable.value- The variable's value.- Returns:
- The handler.
- See Also:
-
withVariables
Sets an object as variables that is used to correlate the message.- Parameters:
variables- The variables as POJO.- Returns:
- The handler.
- See Also:
-
withVariableMap
Sets variables that are used to correlate the message.- Parameters:
variableMap- A map of variables.- Returns:
- The handler.
- See Also:
-