Deprecated (with error)

Use `TestCoroutineScheduler` to control virtual time.

Control the virtual clock time of a CoroutineDispatcher.

Testing libraries may expose this interface to the tests instead of TestCoroutineDispatcher.

This interface is deprecated without replacement. Instead, TestCoroutineScheduler is supposed to be used to control the virtual time. Please see the migration guide for an instruction on how to update the code for the new API.


Link copied to clipboard

Returns the current virtual clock-time as it is known to this Dispatcher.


Link copied to clipboard
abstract fun advanceTimeBy(delayTimeMillis: Long): Long

Moves the Dispatcher's virtual clock forward by a specified amount of time.

Link copied to clipboard

Immediately execute all pending tasks and advance the virtual clock-time to the last delay.

Link copied to clipboard

Call after test code completes to ensure that the dispatcher is properly cleaned up.

Link copied to clipboard
abstract fun pauseDispatcher()

Pause the dispatcher.

abstract suspend fun pauseDispatcher(block: suspend () -> Unit)

Run a block of code in a paused dispatcher.

Link copied to clipboard
abstract fun resumeDispatcher()

Resume the dispatcher from a paused state.

Link copied to clipboard

Run any tasks that are pending at or before the current virtual clock-time.