expectWorker
Specifies that this render pass is expected to run a Worker that has the same type of the given worker and for which the actual worker's doesSameWorkAs
method returns true. If a worker is ran that matches the type of expected, but the actual worker's doesSameWorkAs
returns false, then an AssertionError will be thrown. If you need to perform custom assertions, use the overload of this method that takes an assertWhen
parameter.
Parameters
Worker passed to the actual worker's doesSameWorkAs method to assert the worker matches.
The key passed to runningWorker when rendering this workflow.
If non-null, WorkflowOutput.value will be emitted when this worker is ran. The WorkflowAction used to handle this output can be verified using methods on RenderTestResult.
Optional string that will be used to describe this expectation in error messages.
Specifies that this render pass is expected to run a Worker with the given workerClass. The worker's output type is not taken into consideration.
Parameters
The KClass of the worker that is expected to be run.
The key passed to runningWorker when rendering this workflow.
A function that will be passed the actual worker that matches this expectation and can perform custom assertions on the worker instance.
If non-null, WorkflowOutput.value will be emitted when this worker is ran. The WorkflowAction used to handle this output can be verified using methods on RenderTestResult.
Optional string that will be used to describe this expectation in error messages.
Specifies that this render pass is expected to run a Worker whose KType matches workerType.
Parameters
The KType of the Worker that is expected to be run. This will be compared against the concrete type of the worker that is passed to com.squareup.workflow.runningWorker, but may be a supertype of that type. E.g. an expected worker type of typeOf<Worker<Collection<CharSequence>>>()
will match a worker that has the type SomeConcreteWorker<List<String>>
.
The key passed to runningWorker when rendering this workflow.
A function that will be passed the actual worker that matches this expectation and can perform custom assertions on the worker instance.
If non-null, WorkflowOutput.value will be emitted when this worker is ran. The WorkflowAction used to handle this output can be verified using methods on RenderTestResult.
Optional string that will be used to describe this expectation in error messages.