Class CallActivityHandler

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

public class CallActivityHandler extends Object
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 Details

  • Method Details

    • customize

      public CallActivityHandler customize(Consumer<CallActivityHandler> 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.handleCallActivity().customize(this::prepare);
       
      Parameters:
      customizer - A function that accepts a CallActivityHandler.
      Returns:
      The handler.
    • executeTestCase

      public final <T extends AbstractTestCase> void executeTestCase(T testCase, Consumer<T> customizer)
      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 like simulateProcess or simulateVariable is 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

      public CallActivityHandler simulateVariable(String name, Object value)
      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

      public CallActivityHandler simulateVariables(Object variables)
      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

      public CallActivityHandler simulateVariableMap(Map<String,Object> variableMap)
      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 an ProcessInstanceAssert instance.
      Returns:
      The handler.
    • verifyBindingType

      public CallActivityHandler verifyBindingType(CallActivityBindingType expectedBindingType)
      Verifies the call activity's binding type.
      Parameters:
      expectedBindingType - The expected binding type.
      Returns:
      The handler.
    • verifyBindingType

      public CallActivityHandler verifyBindingType(Consumer<CallActivityBindingType> bindingTypeConsumer)
      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 an ProcessInstanceAssert instance, 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 an ProcessInstanceAssert instance, which is the parent process instance, containing the call activity.
      Returns:
      The handler.
    • verifyProcessId

      public CallActivityHandler verifyProcessId(String expectedProcessId)
      Verifies that the call activity called a process with a specific ID.
      Parameters:
      expectedProcessId - The expected process ID.
      Returns:
      The handler.
    • verifyProcessId

      public CallActivityHandler verifyProcessId(Consumer<String> processIdConsumer)
      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

      public CallActivityHandler verifyProcessIdExpression(Consumer<String> processIdExpressionConsumer)
      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

      public CallActivityHandler verifyVersionTag(String expectedVersionTag)
      Verifies the call activity's version tag.
      Parameters:
      expectedVersionTag - The expected version tag, when binding type is "version tag".
      Returns:
      The handler.
    • verifyVersionTag

      public CallActivityHandler verifyVersionTag(Consumer<String> versionTagConsumer)
      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

      public CallActivityHandler withEscalationCode(String escalationCode)
      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 or null.
      Returns:
      The handler.
    • withErrorCode

      public CallActivityHandler withErrorCode(String errorCode)
      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 or null.
      Returns:
      The handler.