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 or a generated test case for the called process must be executed.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncustomize(Consumer<CallActivityHandler> customizer) Customizes the handler, using the givenConsumerfunction.final <T extends AbstractTestCase>
voidexecuteTestCase(T testCase, Consumer<T> customizer) Executes the given test case, instead of simulating the called process, when the call activity is handled.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.verifyBindingType(Consumer<CallActivityBindingType> bindingTypeConsumer) Verifies the call activity's binding type, using a consumer.verifyBindingType(CallActivityBindingType expectedBindingType) Verifies the call activity's binding type.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).verifyVersionTag(String expectedVersionTag) Verifies the call activity's version tag.verifyVersionTag(Consumer<String> versionTagConsumer) Verifies the call activity's version tag, using a consumer.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.
-
executeTestCase
Executes the given test case, instead of simulating the called process, when the call activity is handled.
Please note: This method initializes the handlers of the given test case. Custom behavior can be defined using a customizer.
When this method is used, the invocation of process simulation related methods likesimulateProcessorsimulateVariableis not allowed!- Parameters:
testCase- A specific test case, that starts with a non start event.customizer- Customizer function that accept the initialized test case.
-
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.
-
verifyBindingType
Verifies the call activity's binding type.- Parameters:
expectedBindingType- The expected binding type.- Returns:
- The handler.
-
verifyBindingType
Verifies the call activity's binding type, using a consumer.- Parameters:
bindingTypeConsumer- A consumer asserting the binding type.- 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.
-
verifyVersionTag
Verifies the call activity's version tag.- Parameters:
expectedVersionTag- The expected version tag, when binding type is "version tag".- Returns:
- The handler.
-
verifyVersionTag
Verifies the call activity's version tag, using a consumer.- Parameters:
versionTagConsumer- A consumer asserting the version tag, when binding type is "version tag".- 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.
-