Package org.camunda.community.bpmndt.api
Class CustomMultiInstanceHandler
java.lang.Object
org.camunda.community.bpmndt.api.CustomMultiInstanceHandler
Fluent API to handle multi instances and multi instance scopes, using custom code - see
execute(BiConsumer).-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncustomize(Consumer<CustomMultiInstanceHandler> customizer) Customizes the handler, using the givenConsumerfunction.voidexecute(BiConsumer<TestCaseInstance, Long> action) Executes a custom action that handles the multi instance or the multi instance scope.voidexecuteLoop(BiConsumer<TestCaseInstance, Long> loopAction) Executes a custom action that handles the multi instance loop.Verifies the multi instance state.verifyLoopCount(int expectedLoopCount) Verifies that the multi instance loop is executed n-times.Verifies that the multi instance loop execution is done in parallel.Verifies that the multi instance loop is sequentially executed.
-
Constructor Details
-
CustomMultiInstanceHandler
-
CustomMultiInstanceHandler
-
-
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.handleMultiInstance().customize(this::prepare);
- Parameters:
customizer- A function that accepts aCustomMultiInstanceHandler.- Returns:
- The handler.
-
execute
Executes a custom action that handles the multi instance or the multi instance scope.- Parameters:
action- A specific action that accepts aTestCaseInstanceand the related process instance key.
-
executeLoop
Executes a custom action that handles the multi instance loop. The given consumer is called once per loop.Please note: If the multi instance is NOT a scope (e.g. embedded sub process), the flow scope key, used to apply handler or to check if an element has been passed, must be obtained via
TestCaseInstance.getFlowScopeKey(long).tc.handleUserTask().executeLoop((instance, elementInstanceKey) -> { var flowScopeKey = instance.getFlowScopeKey(elementInstanceKey); instance.apply(flowScopeKey, userTaskHandler); instance.hasPassed(flowScopeKey, "userTask"); }- Parameters:
loopAction- A specific action that accepts aTestCaseInstanceand the current element instance key.
-
verify
public CustomMultiInstanceHandler verify(Consumer<io.camunda.zeebe.process.test.assertions.ProcessInstanceAssert> verifier) Verifies the multi instance state.Please note: An application specific job worker may have already completed the related job and updated some variables.
- Parameters:
verifier- Verifier that accepts anProcessInstanceAssertinstance.- Returns:
- The handler.
-
verifyLoopCount
Verifies that the multi instance loop is executed n-times.- Parameters:
expectedLoopCount- The expected loop count at the point of time when the multi instance is left (completed or terminated by a boundary event).- Returns:
- The handler.
-
verifyParallel
Verifies that the multi instance loop execution is done in parallel.- Returns:
- The handler.
-
verifySequential
Verifies that the multi instance loop is sequentially executed.- Returns:
- The handler.
-