Skip to content

//workflow/com.squareup.workflow1.testing/WorkerSink

WorkerSink

[jvm] class WorkerSink<T>(name: String, type: KClass<*>) : Worker<T>

Implementation of Worker for integration tests (using launchForTestingFromStartWith or launchForTestingFromStateWith) that need to simply push values into the worker from the test.

Instances of this class are considered equivalent if they have matching type and name.

These workers can not be run concurrently – they may only be run by a single workflow at a time, although they may be run multiple times sequentially. The Flow returned by run will throw an exception if it is collected more than once concurrently.

Parameters

jvm

name

String used to distinguish this worker from other WorkerSinks being ran by the same workflow. Used to implement doesSameWorkAs, see the kdoc on that method for more information.

Constructors

WorkerSink [jvm] fun WorkerSink(name: String, type: KClass<*>)String used to distinguish this worker from other WorkerSinks being ran by the same workflow.

Functions

Name Summary
doesSameWorkAs [jvm]
Content
open override fun doesSameWorkAs(otherWorker: Worker<*>): Boolean


run [jvm]
Content
open override fun run(): Flow<T>


send [jvm]
Content
fun send(value: T)


toString [jvm]
Content
open override fun toString(): String