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

pdegand

10/25/2018, 9:17 AM
afaik, the problem the problem is because the scoped used during the mocking is now different than the one used for the real call, therefor, the Continuation used is different. But I don't know how i can work around this problem.
m

Martin Devillers

10/25/2018, 9:21 AM
Which mocking library are you using?
p

pdegand

10/25/2018, 9:23 AM
mockito-core and com.nhaarman:mockito-kotlin-kt1.1 extensions
m

Martin Devillers

10/25/2018, 9:29 AM
I ran into this issue also, with the implicit continuation, but I couldn’t really find a viable solution. I’m considering Mockk which should support mocking suspending functions. Sorry, it’s not a very encouraging answer. In the meantime I create my mocks manually for classes with suspending members. Generally I end up redirecting the suspending call to non-suspending functions which I actually mock, that way I still get the benefit of Mockito’s fluent syntax.
d

dave08

10/25/2018, 10:08 AM
You can include mockk alongside mockito and gradually migrate if you want...
5 Views