You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The way you have the Funx types set up to allow for mocking functions is slightly verbose for setting up the mocks. If you turn the types into fun interfaces like this:
fun interface Fun0<R> : () -> R
fun interface Fun1<T1, R> : (T1) -> R
fun interface Fun2<T1, T2, R> : (T1, T2) -> R
fun interface Fun3<T1, T2, T3, R> : (T1, T2, T3) -> R
fun interface Fun4<T1, T2, T3, T4, R> : (T1, T2, T3, T4) -> R
fun interface Fun5<T1, T2, T3, T4, T5, R> : (T1, T2, T3, T4, T5) -> R
This lets you simplify your example for mocking functions down to this, eliminating all the references to invoke:
// Stub the mock function
every(block(response))
.returns(file)
// Call something that calls the mock function
s3Client.getObject(request, block)
// Verify the call to the mock function
verify { block(response) }
.wasInvoked(exactly = once)
In addition you need to add suspend versions of these.
The text was updated successfully, but these errors were encountered:
The way you have the Funx types set up to allow for mocking functions is slightly verbose for setting up the mocks. If you turn the types into fun interfaces like this:
This lets you simplify your example for mocking functions down to this, eliminating all the references to invoke:
In addition you need to add suspend versions of these.
The text was updated successfully, but these errors were encountered: