Package org.camunda.community.bpmndt.api
Class ReceiveTaskHandler
java.lang.Object
org.camunda.community.bpmndt.api.ReceiveTaskHandler
Fluent API to handle receive tasks. Please note: a message is correlated by default.
-
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<ReceiveTaskHandler> 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 receive task's waiting state.verifyCorrelationKey(String expectedCorrelationKey) Verifies that the receive task has a specific correlation key.verifyCorrelationKey(Consumer<String> correlationKeyConsumer) Verifies that the receive task has a specific correlation key, using a consumer.verifyCorrelationKeyExpression(Consumer<String> correlationKeyExpressionConsumer) Verifies that the receive task has a specific correlation key FEEL expression (see "Message" section), using a consumer function.verifyMessageName(String expectedMessageName) Verifies that the receive task has a specific message name.verifyMessageName(Consumer<String> messageNameConsumer) Verifies that the receive task has a specific message name, using a consumer.verifyMessageNameExpression(Consumer<String> messageNameExpressionConsumer) Verifies that the receive task has a specific message name FEEL expression (see "Message" section), using a consumer function.voidApplies no action at the wait state.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
-
ReceiveTaskHandler
-
ReceiveTaskHandler
-
-
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.handleReceiveTask().customize(this::prepare);
- Parameters:
customizer- A function that accepts aReceiveTaskHandler.- 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 ReceiveTaskHandler verify(Consumer<io.camunda.zeebe.process.test.assertions.ProcessInstanceAssert> verifier) Verifies the receive task's waiting state.- Parameters:
verifier- Verifier that accepts anProcessInstanceAssertinstance.- Returns:
- The handler.
-
verifyCorrelationKey
Verifies that the receive task has a specific correlation key.- Parameters:
expectedCorrelationKey- The expected correlation key.- Returns:
- The handler.
-
verifyCorrelationKey
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
Verifies that the receive task has a specific message name.- Parameters:
expectedMessageName- The expected message name.- Returns:
- The handler.
-
verifyMessageName
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
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:
-