I have two Coroutines and I want to check if they are running in the same context/Dispatcher. This is a simplified version of my problem, but the answer will apply to the thing I am doing:
@Test
fun test() {
val io = runBlocking(Dispatcher.IO) {
coroutineContext
}
val nonIo = runBlocking() {
coroutineContext
}
assertNotEquals(io, nonIo)
}
However, this is a bad test because I am simply comparing two distinct objects. I want to compare if they use Dispatcher.IO or not.