I've created an executor interface, so when I inje...
# coroutines
s
I've created an executor interface, so when I inject it to the tests, I just inject another executor with main, like this:
Copy code
interface Executor {
    val new: CoroutineDispatcher
    val main: CoroutineDispatcher
}
Injection:
Copy code
class AndroidExecutor : Executor {
    override val new: CoroutineDispatcher = Dispatchers.IO
    override val main: CoroutineDispatcher = Dispatchers.Main
}
Test injection:
Copy code
class TestExecutor : Executor {
    override val new: CoroutineDispatcher = Dispatchers.Main
    override val main: CoroutineDispatcher = Dispatchers.Main
}