TestDispatcherProvider

@ExperimentalCoroutinesApi
class TestDispatcherProvider(default: CoroutineDispatcher, io: CoroutineDispatcher, main: CoroutineDispatcher, mainImmediate: CoroutineDispatcher, unconfined: CoroutineDispatcher) : DispatcherProvider

DispatcherProvider implementation for testing, where each property defaults to a TestCoroutineDispatcher.

A default version will create a different TestCoroutineDispatcher for each property.

Constructors

Link copied to clipboard
fun TestDispatcherProvider(default: CoroutineDispatcher = TestCoroutineDispatcher(), io: CoroutineDispatcher = TestCoroutineDispatcher(), main: CoroutineDispatcher = TestCoroutineDispatcher(), mainImmediate: CoroutineDispatcher = TestCoroutineDispatcher(), unconfined: CoroutineDispatcher = TestCoroutineDispatcher())

Functions

Link copied to clipboard
open override fun copy(default: CoroutineDispatcher, io: CoroutineDispatcher, main: CoroutineDispatcher, mainImmediate: CoroutineDispatcher, unconfined: CoroutineDispatcher): TestDispatcherProvider
Link copied to clipboard
open override fun <R> fold(initial: R, operation: (R, CoroutineContext.Element) -> R): R
Link copied to clipboard
open operator override fun <E : CoroutineContext.Element> get(key: CoroutineContext.Key<E>): E?
Link copied to clipboard
open override fun minusKey(key: CoroutineContext.Key<*>): CoroutineContext
Link copied to clipboard
open operator fun plus(context: CoroutineContext): CoroutineContext

Properties

Link copied to clipboard
open override val default: CoroutineDispatcher

CoroutineDispatcher generally intended for cpu-bound tasks.

Link copied to clipboard
open override val io: CoroutineDispatcher

CoroutineDispatcher generally intended for blocking I/O tasks.

Link copied to clipboard
open override val key: CoroutineContext.Key<*>
Link copied to clipboard
open override val main: CoroutineDispatcher

CoroutineDispatcher which is confined to the "main" thread.

Link copied to clipboard
open override val mainImmediate: CoroutineDispatcher

CoroutineDispatcher which is confined to the "main" thread with immediate dispatch.

Link copied to clipboard
open override val unconfined: CoroutineDispatcher

Corresponds to the Dispatchers.Unconfined property in a default implementation.

Sources

Link copied to clipboard