TestDispatchersProvider

class TestDispatchersProvider(testDispatcher: CoroutineDispatcher = UnconfinedTestDispatcher()) : DispatchersProvider

Test implementation of DispatchersProvider that provides a single test dispatcher for all coroutine contexts.

This implementation is useful for unit testing, for components that require a DispatchersProvider dependency.

Constructors

Link copied to clipboard
constructor(testDispatcher: CoroutineDispatcher = UnconfinedTestDispatcher())

Functions

Link copied to clipboard
open override fun default(): CoroutineDispatcher

Returns the test dispatcher for the default context.

Link copied to clipboard
open override fun io(): CoroutineDispatcher

Returns the test dispatcher for the IO context.

Link copied to clipboard
open override fun main(): CoroutineDispatcher

Returns the test dispatcher for the main context.

Link copied to clipboard
open override fun unconfined(): CoroutineDispatcher

Returns the test dispatcher for the unconfined context.