Skip to content

Instantly share code, notes, and snippets.

@atomgomba
Last active March 4, 2019 13:26
Show Gist options
  • Save atomgomba/199165896ef9cbfac6577d73e0569a82 to your computer and use it in GitHub Desktop.
Save atomgomba/199165896ef9cbfac6577d73e0569a82 to your computer and use it in GitHub Desktop.
Kotlin coroutine dispatcher for unit testing
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Runnable
import kotlin.coroutines.CoroutineContext
/**
* @author Károly Kiripolszky <[email protected]>
*/
class TestCoroutineDispatcher : CoroutineDispatcher() {
override fun dispatch(context: CoroutineContext, block: Runnable) {
block.run()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment