KStubbing

class KStubbing<out T : Any>(val mock: T)

Constructors

Link copied to clipboard
constructor(mock: T)

Properties

Link copied to clipboard
val mock: T

Functions

Link copied to clipboard
inline fun <R> on(methodCall: R): OngoingStubbing<R>
fun <R> on(methodCall: suspend T.() -> R): OngoingStubbing<R>

Enables stubbing methods/function calls. In case of Kotlin function calls, these can be either synchronous or suspendable function calls.

Link copied to clipboard
infix fun Stubber.on(methodCall: suspend T.() -> Unit)

Stubs a method/function call in a reverse manner, as part of a mock being created. You can reverse stub either synchronous as well as suspendable function calls.

Link copied to clipboard
fun <T : Any, R> KStubbing<T>.onBlocking(methodCall: suspend T.() -> R): OngoingStubbing<R>

Enables stubbing methods/function calls. In case of Kotlin function calls, these can be either synchronous or suspendable function calls.

Link copied to clipboard
inline fun <R : Any> onGeneric(noinline methodCall: suspend T.() -> R?): OngoingStubbing<R>
fun <R : Any> onGeneric(methodCall: suspend T.() -> R?, clazz: KClass<R>): OngoingStubbing<R>

Enables stubbing methods/function calls with a generics return type R. In case of Kotlin function calls, these can be either synchronous or suspendable function calls.