bdawg.io
08/21/2018, 2:31 PMContinuation
?Martin Devillers
08/21/2018, 2:32 PMbdawg.io
08/21/2018, 2:37 PMContinuation
(I’m not sure what the matcher is called, I don’t have a project using Mockito right now)
Something along the lines of Mockito.verify(mock).invoke(any(), instanceOf(Continuation::class.java))
Martin Devillers
08/21/2018, 2:39 PMbdawg.io
08/21/2018, 2:41 PMrunBlocking
is executing the block as a coroutine. The compiler will automatically pass the Continuation. You just need to verify it was passed. I looked up the matcher as well:Mockito.verify(mock).invoke(any(), any(Continuation::class.java))
https://static.javadoc.io/org.mockito/mockito-core/2.21.0/org/mockito/ArgumentMatchers.html#any-java.lang.Class-Martin Devillers
08/21/2018, 2:48 PMinvoke
is the method on the instance, which doesn’t have a Continuation
instance visible within Kotlin. It’s added by the compiler.bdawg.io
08/21/2018, 2:51 PMMockito.verify(mock)
return SuspendingAction
as a proxy? I’m not very familiar with Mockito specificallyMartin Devillers
08/21/2018, 2:53 PMpublic static <T> T verify(T mock)
it returns an instance of the class being verified, which is actually the mock itself decorated in order to perform assertions on it. You then call the instance methods on it, and Mockito verifies that they were also called on the mock itself.bdawg.io
08/21/2018, 2:58 PMany()
matcher and instantiating an instance of Any()
directly 🤷 best of luck on it though!Martin Devillers
08/21/2018, 2:59 PMgroostav
08/21/2018, 11:56 PMval verifier = Mockito.verify(mock)
val arg1Ignored = any(firstArgType::class)
val arg2Ignored = any(Continuation::class)
verifier.invoke(arg1Ignored)
Continuation
onto the stack. IIRC the actual value passed into the method invocation is erroneousMartin Devillers
08/22/2018, 7:56 AM