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 stageACTION- 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
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionand()Returns the typed fixture to use.Waits until any active workflow execution exists.executionExists(Predicate<WorkflowExecution> predicate) Waits until an active workflow execution matching the predicate exists.Asserts that every given step exists in the selected workflow state.hasStepsInAnyOrder(String stepName, String... stepNames) Asserts that the selected workflow state contains exactly the given steps in any order.historyExists(WorkflowStatus workflowStatus) Waits until at least one workflow history exists and has the given status.historyExists(String workflowId) Waits until a workflow history exists for the given workflow id.historyExists(Predicate<WorkflowHistory> predicate) Waits until a workflow history matching the predicate exists.protected voidinitialize(WorkflowTestFixture<?, ?> fixture, WorkflowTestDriver testDriver) Initializes this phase with the owning fixture and the shared test driver.Asserts that no active workflow execution is present.Asserts that no workflow history is recorded.Asserts that the selected workflow state does not contain the given step.payloadContains(Map<String, @Nullable Object> expectedPayload) Asserts that the selected workflow history payload contains the expected payload.payloadEquals(Map<String, @Nullable Object> expectedPayload) Asserts that the selected workflow history payload equals the expected payload.payloadMatches(Predicate<Map<String, @Nullable Object>> predicate) Asserts that the selected workflow history payload satisfies the given predicate.payloadSatisfies(Consumer<Map<String, @Nullable Object>> payloadConsumer) Applies a given consumer to the selected workflow history payload.step(String stepName, StepStatus stepStatus) Asserts that a step has the expected execution status.stepsPassed(String stepName, String... stepNames) Asserts that every given step has been passed.voidstop()Shuts down the test driver and all services.Asserts that the selected workflow execution is waiting in every given step.workflowFinished(WorkflowStatus workflowStatus) Asserts that the workflow has finished with the given status.Asserts that the selected workflow state is not terminal.workflowStateSatisfies(Consumer<WorkflowState> workflowStateConsumer) Applies a given consumer to the workflow state of the current history.
-
Field Details
-
fixture
-
testDriver
-
-
Constructor Details
-
Then
public Then()
-
-
Method Details
-
and
Returns the typed fixture to use.- Returns:
- fixture to continue fluent invocations
-
waitingIn
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 namestepNames- additional expected waiting step names- Returns:
- this phase for fluent chaining
-
stepsPassed
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 namestepNames- additional expected passed step names- Returns:
- this phase for fluent chaining
-
hasSteps
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 namestepNames- additional expected step names- Returns:
- this phase for fluent chaining
-
hasStepsInAnyOrder
Asserts that the selected workflow state contains exactly the given steps in any order.- Parameters:
stepName- first expected step namestepNames- additional expected step names- Returns:
- this phase for fluent chaining
-
noStep
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
Asserts that the selected workflow state is not terminal.- Returns:
- this phase for fluent chaining
-
workflowFinished
Asserts that the workflow has finished with the given status.- Parameters:
workflowStatus- expected terminal workflow status- Returns:
- this phase for fluent chaining
-
payloadSatisfies
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
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
Asserts that the selected workflow history payload equals the expected payload.- Parameters:
expectedPayload- expected workflow payload- Returns:
- this phase for fluent chaining
-
payloadContains
Asserts that the selected workflow history payload contains the expected payload.- Parameters:
expectedPayload- expected workflow payload- Returns:
- this phase for fluent chaining
-
workflowStateSatisfies
Applies a given consumer to the workflow state of the current history.- Parameters:
workflowStateConsumer- workflow state consumer- Returns:
- this phase for fluent chaining
-
step
Asserts that a step has the expected execution status.- Parameters:
stepName- step name to inspectstepStatus- expected step status- Returns:
- this phase for fluent chaining
-
initialize
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 fixturetestDriver- shared workflow test driver
-
executionExists
Waits until any active workflow execution exists.- Returns:
- this phase for fluent chaining
-
executionExists
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
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
Waits until a workflow history exists for the given workflow id.- Parameters:
workflowId- workflow id to find- Returns:
- this phase for fluent chaining
-
historyExists
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
Asserts that no active workflow execution is present.- Returns:
- this phase for fluent chaining
-
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.
-