Class Then<SELF extends Then<SELF,ACTION>,ACTION extends GivenWhen<ACTION,SELF>>

java.lang.Object
io.axoniq.framework.workflow.runtime.test.fixture.Phase<SELF>
io.axoniq.framework.workflow.runtime.test.fixture.Then<SELF,ACTION>
Type Parameters:
SELF - type of assert stage
ACTION - type of action stage
Direct Known Subclasses:
Then.Phase

public class Then<SELF extends Then<SELF,ACTION>,ACTION extends GivenWhen<ACTION,SELF>> extends Phase<SELF>
A stage for defining the workflow assertions.
Since:
5.4.0
Author:
Simon Zambrovski
  • Field Details

  • Constructor Details

    • Then

      public Then()
  • Method Details

    • and

      Returns the typed fixture to use.
      Returns:
      fixture to continue fluent invocations
    • waitingIn

      public SELF waitingIn(String stepName, String... stepNames)
      Asserts that the selected workflow execution is waiting in every given step.

      A waiting step is present and not in a terminal state.

      Parameters:
      stepName - first expected waiting step name
      stepNames - additional expected waiting step names
      Returns:
      this phase for fluent chaining
    • stepsPassed

      public SELF stepsPassed(String stepName, String... stepNames)
      Asserts that every given step has been passed.

      A passed step is present in the selected execution or history and is in a terminal state.

      Parameters:
      stepName - first expected passed step name
      stepNames - additional expected passed step names
      Returns:
      this phase for fluent chaining
    • hasSteps

      public SELF hasSteps(String stepName, String... stepNames)
      Asserts that every given step exists in the selected workflow state.

      The selected workflow state can be an active execution or a stored history.

      Parameters:
      stepName - first expected step name
      stepNames - additional expected step names
      Returns:
      this phase for fluent chaining
    • hasStepsInAnyOrder

      public SELF hasStepsInAnyOrder(String stepName, String... stepNames)
      Asserts that the selected workflow state contains exactly the given steps in any order.
      Parameters:
      stepName - first expected step name
      stepNames - additional expected step names
      Returns:
      this phase for fluent chaining
    • noStep

      public SELF noStep(String stepName)
      Asserts that the selected workflow state does not contain the given step.
      Parameters:
      stepName - step name that must be absent
      Returns:
      this phase for fluent chaining
    • workflowNotFinished

      public SELF workflowNotFinished()
      Asserts that the selected workflow state is not terminal.
      Returns:
      this phase for fluent chaining
    • workflowFinished

      public SELF workflowFinished(WorkflowStatus workflowStatus)
      Asserts that the workflow has finished with the given status.
      Parameters:
      workflowStatus - expected terminal workflow status
      Returns:
      this phase for fluent chaining
    • payloadSatisfies

      public SELF payloadSatisfies(Consumer<Map<String,@Nullable Object>> payloadConsumer)
      Applies a given consumer to the selected workflow history payload.
      Parameters:
      payloadConsumer - consumer for payload retrieved from the current testing state.
      Returns:
      this phase for fluent chaining
    • payloadMatches

      public SELF payloadMatches(Predicate<Map<String,@Nullable Object>> predicate)
      Asserts that the selected workflow history payload satisfies the given predicate.
      Parameters:
      predicate - predicate to test the payload against
      Returns:
      this phase for fluent chaining
    • payloadEquals

      public SELF payloadEquals(Map<String,@Nullable Object> expectedPayload)
      Asserts that the selected workflow history payload equals the expected payload.
      Parameters:
      expectedPayload - expected workflow payload
      Returns:
      this phase for fluent chaining
    • payloadContains

      public SELF payloadContains(Map<String,@Nullable Object> expectedPayload)
      Asserts that the selected workflow history payload contains the expected payload.
      Parameters:
      expectedPayload - expected workflow payload
      Returns:
      this phase for fluent chaining
    • workflowStateSatisfies

      public SELF workflowStateSatisfies(Consumer<WorkflowState> workflowStateConsumer)
      Applies a given consumer to the workflow state of the current history.
      Parameters:
      workflowStateConsumer - workflow state consumer
      Returns:
      this phase for fluent chaining
    • step

      public SELF step(String stepName, StepStatus stepStatus)
      Asserts that a step has the expected execution status.
      Parameters:
      stepName - step name to inspect
      stepStatus - expected step status
      Returns:
      this phase for fluent chaining
    • initialize

      protected void initialize(WorkflowTestFixture<?,?> fixture, WorkflowTestDriver testDriver)
      Initializes this phase with the owning fixture and the shared test driver.

      The fixture calls this during construction so both phases operate on the same underlying workflow runtime and testing state.

      Parameters:
      fixture - owning workflow test fixture
      testDriver - shared workflow test driver
    • executionExists

      public SELF executionExists()
      Waits until any active workflow execution exists.
      Returns:
      this phase for fluent chaining
    • executionExists

      public SELF executionExists(Predicate<WorkflowExecution> predicate)
      Waits until an active workflow execution matching the predicate exists.

      If exactly one execution matches, it becomes the selected execution for subsequent assertions.

      Parameters:
      predicate - predicate used to select matching executions
      Returns:
      this phase for fluent chaining
    • historyExists

      public SELF historyExists(Predicate<WorkflowHistory> predicate)
      Waits until a workflow history matching the predicate exists.

      If exactly one history matches, it becomes the selected history for subsequent assertions.

      Parameters:
      predicate - predicate used to select matching histories
      Returns:
      this phase for fluent chaining
    • historyExists

      public SELF historyExists(String workflowId)
      Waits until a workflow history exists for the given workflow id.
      Parameters:
      workflowId - workflow id to find
      Returns:
      this phase for fluent chaining
    • historyExists

      public SELF historyExists(WorkflowStatus workflowStatus)
      Waits until at least one workflow history exists and has the given status.
      Parameters:
      workflowStatus - expected workflow status
      Returns:
      this phase for fluent chaining
    • noExecution

      public SELF noExecution()
      Asserts that no active workflow execution is present.
      Returns:
      this phase for fluent chaining
    • noHistory

      public SELF noHistory()
      Asserts that no workflow history is recorded.
      Returns:
      this phase for fluent chaining
    • stop

      public void stop()
      Shuts down the test driver and all services.