suspendCallTo

inline suspend fun <RECEIVER : Any> <Error class: unknown class>.suspendCallTo(callable: KCallable<*>, receiver: RECEIVER): Any?

Allows for reflection-based stubbing of suspend methods.

Usage example (mock all member functions in one mock):

val mock = mockk() mock.javaClass.kotlin.memberFunctions.forEach { coEvery { suspendCallTo(it, receiver = mock) } answers { /* some default answer */ } }

Note: receiver must be a mockk


suspend fun <Error class: unknown class>.suspendCallTo(    callable: KCallable<*>,     receiver: Any,     receiverType: KType): Any?

Allows for reflection-based stubbing of suspend methods.

Usage example (mock all member functions in one mock):

val mock = mockk() val mockType = typeOf() mock.javaClass.kotlin.memberFunctions.forEach { coEvery { suspendCallTo(it, receiver = mock, receiverType = mockType) } answers { /* some default answer */ } }

Note: receiver must be a mockk