What's the recommended way for swapping Default an...
# coroutines
m
What's the recommended way for swapping Default and IO schedulers for UI tests on Android
s
Structure your code in such a way that you inject the Dispatchers into your code (possibly use dependency injection (DI) framework). No swapping required, just change your DI a bit.
👍 1
m
Was thinking about how to achieve something similar to RxJavaPlugins
i
Copy code
@Before
    fun setup() {
        Dispatchers.setMain(Dispatchers.Unconfined)
    }

    @After
    fun tearDown() {
        Dispatchers.resetMain()
    }
s
^^^ That is only for the Main dispatcher. Not sure if you can do the same for the IO and Default.