Package org.camunda.community.bpmndt.api
Class CallActivityHandler
java.lang.Object
org.camunda.community.bpmndt.api.CallActivityHandler
Fluent API to handle call activities. The called process must be simulated - see
TestCaseExecutor.simulateProcess(String)-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncustomize(Consumer<CallActivityHandler> customizer) Customizes the handler, using the givenConsumerfunction.simulateVariable(String name, Object value) Sets a variable to simulate the results of a called sub process execution.simulateVariableMap(Map<String, Object> variableMap) Sets variables to simulate the results of a called sub process execution.simulateVariables(Object variables) Sets an object as variables to simulate the results of a called sub process execution.Verifies the call activity's waiting state.verifyInput(Consumer<io.camunda.zeebe.process.test.assertions.ProcessInstanceAssert> inputVerifier) Verifies the call activity's input propagation, which parent variables have been propagated to the child process instance.verifyOutput(Consumer<io.camunda.zeebe.process.test.assertions.ProcessInstanceAssert> outputVerifier) Verifies the call activity's output propagation - which child variables have been propagated to the parent process instance.verifyProcessId(String expectedProcessId) Verifies that the call activity called a process with a specific ID.verifyProcessId(Consumer<String> processIdConsumer) Verifies that the call activity called a process with a specific ID, using a consumer.verifyProcessIdExpression(Consumer<String> processIdExpressionConsumer) Verifies that the call activity has a specific process ID FEEL expression (see "Called element" section), using a consumer function.verifyPropagateAllChildVariables(Boolean expectedPropagateAllChildVariables) Verifies if the call activity has the propagation of all child variables enabled (see "Output propagation" section).verifyPropagateAllParentVariables(Boolean expectedPropagateAllParentVariables) Verifies if the call activity has the propagation of all parent variables enabled (see "Input propagation" section).voidApplies no action at the wait state.withErrorCode(String errorCode) Sets the error code for ending the called process instance with an error end event, propagating the given code.withEscalationCode(String escalationCode) Sets the escalation code for ending the called process instance with an escalation end event, propagating the given code.
-
Constructor Details
-
CallActivityHandler
-
CallActivityHandler
-
-
Method Details
-
customize
Customizes the handler, using the givenConsumerfunction. This method can be used to apply a common customization needed for different test cases.tc.handleCallActivity().customize(this::prepare);
- Parameters:
customizer- A function that accepts aCallActivityHandler.- Returns:
- The handler.
-
simulateVariable
Sets a variable to simulate the results of a called sub process execution.- Parameters:
name- The name of the variable.value- The variable's value.- Returns:
- The handler.
-
simulateVariables
Sets an object as variables to simulate the results of a called sub process execution.- Parameters:
variables- The variables as POJO.- Returns:
- The handler.
-
simulateVariableMap
Sets variables to simulate the results of a called sub process execution.- Parameters:
variableMap- A map of variables.- Returns:
- The handler.
-
verify
public CallActivityHandler verify(Consumer<io.camunda.zeebe.process.test.assertions.ProcessInstanceAssert> verifier) Verifies the call activity's waiting state.- Parameters:
verifier- Verifier that accepts anProcessInstanceAssertinstance.- Returns:
- The handler.
-
verifyInput
public CallActivityHandler verifyInput(Consumer<io.camunda.zeebe.process.test.assertions.ProcessInstanceAssert> inputVerifier) Verifies the call activity's input propagation, which parent variables have been propagated to the child process instance.- Parameters:
inputVerifier- Verifier that accepts anProcessInstanceAssertinstance, which is the child process instance, started by the call activity.- Returns:
- The handler.
-
verifyOutput
public CallActivityHandler verifyOutput(Consumer<io.camunda.zeebe.process.test.assertions.ProcessInstanceAssert> outputVerifier) Verifies the call activity's output propagation - which child variables have been propagated to the parent process instance.Please note: An application specific job worker may have already advanced the process instance and updated some variables.
- Parameters:
outputVerifier- Verifier that accepts anProcessInstanceAssertinstance, which is the parent process instance, containing the call activity.- Returns:
- The handler.
-
verifyProcessId
Verifies that the call activity called a process with a specific ID.- Parameters:
expectedProcessId- The expected process ID.- Returns:
- The handler.
-
verifyProcessId
Verifies that the call activity called a process with a specific ID, using a consumer.- Parameters:
processIdConsumer- A consumer asserting the process ID.- Returns:
- The handler.
-
verifyProcessIdExpression
Verifies that the call activity has a specific process ID FEEL expression (see "Called element" section), using a consumer function.- Parameters:
processIdExpressionConsumer- A consumer asserting the process ID expression.- Returns:
- The handler.
-
verifyPropagateAllChildVariables
public CallActivityHandler verifyPropagateAllChildVariables(Boolean expectedPropagateAllChildVariables) Verifies if the call activity has the propagation of all child variables enabled (see "Output propagation" section).- Parameters:
expectedPropagateAllChildVariables- The expected value.- Returns:
- The handler.
-
verifyPropagateAllParentVariables
public CallActivityHandler verifyPropagateAllParentVariables(Boolean expectedPropagateAllParentVariables) Verifies if the call activity has the propagation of all parent variables enabled (see "Input propagation" section).- Parameters:
expectedPropagateAllParentVariables- The expected value.- 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). -
withEscalationCode
Sets the escalation code for ending the called process instance with an escalation end event, propagating the given code.- Parameters:
escalationCode- A specific escalation code ornull.- Returns:
- The handler.
-
withErrorCode
Sets the error code for ending the called process instance with an error end event, propagating the given code.- Parameters:
errorCode- A specific error code ornull.- Returns:
- The handler.
-