do Suspendable Answer
Sets an answer to be applied when the stubbed suspendable function is being called, specified by a suspendable lambda. E.g:
whenever { mock.someFunction() } doSuspendableAnswer { "result" }This function is an alias for Mockito's OngoingStubbing.thenAnswer, but also taking extra steps to wire the suspendable lambda answer properly into the Kotlin's coroutine context of the stubbed suspendable function call.
Return
OngoingStubbing object used to stub fluently. Do not create a reference to this returned object.
Parameters
to be applied on the suspendable function invocation.
Sets a generic answer, specified with a suspendable lambda, to be applied in reverse stubbing.
Example:
doSuspendableAnswer { "result" }.whenever(mock).someMethod()This function is an alias for Mockito's Mockito.doAnswer, but also taking extra steps to wire the suspendable lambda answer properly into the Kotlin's coroutine context of the stubbed suspendable function call.
See examples in javadoc for Mockito class
Return
Stubber object used to stub fluently.
Parameters
to answer to apply when the stubbed method/function is being called.