Class ReceiveTaskHandler

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

public class ReceiveTaskHandler extends Object
Fluent API to handle receive tasks. 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 ReceiveTaskHandler customize(Consumer<ReceiveTaskHandler> 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.handleReceiveTask().customize(this::prepare);
       
      Parameters:
      customizer - A function that accepts a ReceiveTaskHandler.
      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 ReceiveTaskHandler verify(Consumer<io.camunda.zeebe.process.test.assertions.ProcessInstanceAssert> verifier)
      Verifies the receive task's waiting state.
      Parameters:
      verifier - Verifier that accepts an ProcessInstanceAssert instance.
      Returns:
      The handler.
    • verifyCorrelationKey

      public ReceiveTaskHandler verifyCorrelationKey(String expectedCorrelationKey)
      Verifies that the receive task has a specific correlation key.
      Parameters:
      expectedCorrelationKey - The expected correlation key.
      Returns:
      The handler.
    • verifyCorrelationKey

      public ReceiveTaskHandler verifyCorrelationKey(Consumer<String> correlationKeyConsumer)
      Verifies that the receive task has a specific correlation key, using a consumer.
      Parameters:
      correlationKeyConsumer - A consumer asserting the correlation key.
      Returns:
      The handler.
    • verifyCorrelationKeyExpression

      public ReceiveTaskHandler verifyCorrelationKeyExpression(Consumer<String> correlationKeyExpressionConsumer)
      Verifies that the receive task 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 ReceiveTaskHandler verifyMessageName(String expectedMessageName)
      Verifies that the receive task has a specific message name.
      Parameters:
      expectedMessageName - The expected message name.
      Returns:
      The handler.
    • verifyMessageName

      public ReceiveTaskHandler verifyMessageName(Consumer<String> messageNameConsumer)
      Verifies that the receive task has a specific message name, using a consumer.
      Parameters:
      messageNameConsumer - A consumer asserting the message name.
      Returns:
      The handler.
    • verifyMessageNameExpression

      public ReceiveTaskHandler verifyMessageNameExpression(Consumer<String> messageNameExpressionConsumer)
      Verifies that the receive task 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.
    • waitForBoundaryEvent

      public void waitForBoundaryEvent()
      Applies no action at the wait state. This is required when waiting for events (e.g. message, signal or timer events) that are attached as boundary events on the element itself or on the surrounding scope (e.g. embedded subprocess).
    • withVariable

      public ReceiveTaskHandler 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 ReceiveTaskHandler 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 ReceiveTaskHandler 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: