Class TestCaseInstance

java.lang.Object
org.camunda.community.bpmndt.api.TestCaseInstance
All Implemented Interfaces:
AutoCloseable

public class TestCaseInstance extends Object implements AutoCloseable
Link between a test case and its execution.

This class is utilizing a process instance that was instantiated by a TestCaseExecutor and handlers (e.g. UserTaskHandler) that are part of a test case.

  • Method Details

    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • apply

      public void apply(long flowScopeKey, CallActivityHandler handler)
    • apply

      public void apply(long flowScopeKey, CustomMultiInstanceHandler handler)
    • apply

      public void apply(long flowScopeKey, JobHandler handler)
    • apply

      public void apply(long flowScopeKey, MessageEventHandler handler)
    • apply

      public void apply(long flowScopeKey, OutboundConnectorHandler handler)
    • apply

      public void apply(long flowScopeKey, ReceiveTaskHandler handler)
    • apply

      public void apply(long flowScopeKey, SignalEventHandler handler)
    • apply

      public void apply(long flowScopeKey, TimerEventHandler handler)
    • apply

      public void apply(long flowScopeKey, UserTaskHandler handler)
    • createException

      public RuntimeException createException(String message, long flowScopeKey)
    • getClient

      public io.camunda.zeebe.client.ZeebeClient getClient()
    • getEngine

      public io.camunda.zeebe.process.test.api.ZeebeTestEngine getEngine()
    • getElementInstanceKey

      public long getElementInstanceKey(long flowScopeKey, String elementId)
      Returns the element instance key for a BPMN element within a given flow scope.
      Parameters:
      flowScopeKey - The key of an existing flow scope.
      elementId - The BPMN element ID.
      Returns:
      The element instance key.
      Throws:
      RuntimeException - If no such element instance exists.
    • getFlowScopeKey

      public long getFlowScopeKey(long elementInstanceKey)
      Returns the flow scope key of an element instance.
      Parameters:
      elementInstanceKey - The key of an existing element instance.
      Returns:
      The flow scope key or -1 if there is no mapping for the given element instance.
    • getProcessInstanceKey

      public long getProcessInstanceKey(long elementInstanceKey)
      Returns the process instance key of an element instance.
      Parameters:
      elementInstanceKey - The key of an existing element instance.
      Returns:
      The process instance key.
    • hasPassed

      public void hasPassed(long flowScopeKey, String elementId)
      Checks if a BPMN element has been passed within the given flow scope.
      Parameters:
      flowScopeKey - The key of an existing flow scope.
      elementId - The BPMN element ID to test.
      Throws:
      RuntimeException - If the BPMN element has not been passed (is not completed).
    • hasPassedMultiInstance

      public void hasPassedMultiInstance(long flowScopeKey, String elementId)
      Checks if a BPMN multi instance element has been passed within the given flow scope.
      Parameters:
      flowScopeKey - The key of an existing flow scope.
      elementId - The BPMN element ID to test.
      Throws:
      RuntimeException - If the BPMN multi instance element has not been passed (is not completed).
    • hasTerminated

      public void hasTerminated(long flowScopeKey, String elementId)
      Checks if a BPMN element has been terminated within the given flow scope.
      Parameters:
      flowScopeKey - The key of an existing flow scope.
      elementId - The BPMN element ID to test.
      Throws:
      RuntimeException - If the BPMN element has not been terminated.
    • hasTerminatedMultiInstance

      public void hasTerminatedMultiInstance(long flowScopeKey, String elementId)
      Checks if a BPMN multi instance element has been terminated within the given flow scope.
      Parameters:
      flowScopeKey - The key of an existing flow scope.
      elementId - The BPMN element ID to test.
      Throws:
      RuntimeException - If the BPMN multi instance element has not been terminated.
    • isCompleted

      public void isCompleted(long processInstanceKey)
      Checks if the given process instance is completed.
      Parameters:
      processInstanceKey - The key of an existing process instance.
      Throws:
      RuntimeException - If the process instance is not completed.
    • isWaitingAt

      public void isWaitingAt(long flowScopeKey, String elementId)
      Checks if a flow is waiting at a specific BPMN element.
      Parameters:
      flowScopeKey - The key of an existing flow scope.
      elementId - The BPMN element to test.
      Throws:
      RuntimeException - If the flow is not waiting at the BPMN element.