Class MessageEventHandler

java.lang.Object
org.camunda.community.bpmndt.api.MessageEventHandler

public class MessageEventHandler extends Object
Fluent API to handle message catch events. Please note: a message is correlated by default.
  • Constructor Details

  • 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

      public MessageEventHandler customize(Consumer<MessageEventHandler> customizer)
      Customizes the handler, using the given Consumer function. 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 a MessageEventHandler.
      Returns:
      The handler.
    • execute

      public void execute(MessageEventHandler.Correlation action)
      Correlates the message using a custom action, when the process instance is waiting at the corresponding element.
      Parameters:
      action - A specific action that implements the MessageEventHandler.Correlation or accepts a ZeebeClient, the message name and the correlation key.
      See Also:
      • ZeebeClient.newPublishMessageCommand()
    • 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 an ProcessInstanceAssert instance.
      Returns:
      The handler.
    • verifyCorrelationKey

      public MessageEventHandler verifyCorrelationKey(String expectedCorrelationKey)
      Verifies that the message event has a specific correlation key.
      Parameters:
      expectedCorrelationKey - The expected correlation key.
      Returns:
      The handler.
    • verifyCorrelationKey

      public MessageEventHandler verifyCorrelationKey(Consumer<String> correlationKeyConsumer)
      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

      public MessageEventHandler verifyMessageName(String expectedMessageName)
      Verifies that the message event has a specific message name.
      Parameters:
      expectedMessageName - The expected message name.
      Returns:
      The handler.
    • verifyMessageName

      public MessageEventHandler verifyMessageName(Consumer<String> messageNameConsumer)
      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

      public MessageEventHandler withVariable(String name, Object value)
      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

      public MessageEventHandler withVariables(Object variables)
      Sets an object as variables that is used to correlate the message.
      Parameters:
      variables - The variables as POJO.
      Returns:
      The handler.
      See Also:
    • withVariableMap

      public MessageEventHandler withVariableMap(Map<String,Object> variableMap)
      Sets variables that are used to correlate the message.
      Parameters:
      variableMap - A map of variables.
      Returns:
      The handler.
      See Also: