https://kotlinlang.org logo
#coroutines
Title
# coroutines
p

Paul Woitaschek

01/29/2020, 3:39 PM
I inject `CoroutineDispatcher`s in some classes I want to test and have no idea how to get that from a TestCoroutineScope
s

streetsofboston

01/29/2020, 3:47 PM
You get it from the scope's CoroutineContext
p

Paul Woitaschek

01/29/2020, 3:48 PM
And how?
p

paulblessing

01/29/2020, 3:49 PM
coroutineContext[ContinuationInterceptor] as TestCoroutineDispatcher
is what I use
s

streetsofboston

01/29/2020, 3:49 PM
Not sure what the key is, something like coroutineContext[ContinuationInterceptor]
p

Paul Woitaschek

01/29/2020, 3:50 PM
Thanks that will do it 🙂
2 Views