nquinn
03/26/2017, 4:30 PMfun <T> OngoingStubbing<Deferred<T>>.thenDeferred(value: T) : OngoingStubbing<Deferred<T>> {
return thenReturn( async(CommonPool) { value })
}
whenever( mockConnection.updateWithParams(sql, params)).thenDeferred(UpdateResult())
returns something i can .await() on just fine, but if I make the signature of the suspend fun updateWithParams(…): UpdateResult vs fun updatedWithParams(..): Deferred<UpdateResult>, I always get null as a result to the mocked function
2 replies
https://github.com/NathanQuinn/mockito-coroutines-sample I posted this up as an example, I think it shows the issue I am trying to solve