Package-level declarations

Types

Link copied to clipboard
interface MockMany2<T1 : Any, T2 : Any>

Marker interface for mock of T1 and T2.

Link copied to clipboard
interface MockMany3<T1 : Any, T2 : Any, T3 : Any> : MockMany2<T1, T2>

Marker interface for mock of T1, T2 and T3.

Link copied to clipboard
interface MockMany4<T1 : Any, T2 : Any, T3 : Any, T4 : Any> : MockMany3<T1, T2, T3>

Marker interface for mock of T1, T2, T3 and T4.

Link copied to clipboard
interface MockMany5<T1 : Any, T2 : Any, T3 : Any, T4 : Any, T5 : Any> : MockMany4<T1, T2, T3, T4>

Marker interface for mock of T1, T2, T3, T4 and T5.

Properties

Link copied to clipboard
val <T1 : Any> MockMany2<T1, *>.t1: T1

Casts this as T1.

Link copied to clipboard
val <T2 : Any> MockMany2<*, T2>.t2: T2

Casts this as T2.

Link copied to clipboard
val <T3 : Any> MockMany3<*, *, T3>.t3: T3

Casts this as T3.

Link copied to clipboard
val <T4 : Any> MockMany4<*, *, *, T4>.t4: T4

Casts this as T4.

Link copied to clipboard
val <T5 : Any> MockMany5<*, *, *, *, T5>.t5: T5

Casts this as T5.

Functions

Link copied to clipboard

Starts defining an answer for a single function call specified by block. Returned scope allows defining answer.

Link copied to clipboard
fun <T> everySuspend(block: suspend ArgMatchersScope.() -> T): SuspendAnsweringScope<T>

Just like every, but allows suspendable function call.

Link copied to clipboard
inline fun <T : Any> mock(mode: MockMode = MokkeryCompilerDefaults.mockMode, block: T.() -> Unit = { }): T

Provides mock implementation of given type T.

Link copied to clipboard
inline fun <T1 : Any, T2 : Any> mockMany(mode: MockMode = MokkeryCompilerDefaults.mockMode, block: MockMany2<T1, T2>.() -> Unit = { }): MockMany2<T1, T2>

Provides mock implementation of T1 and T2.

inline fun <T1 : Any, T2 : Any, T3 : Any> mockMany(mode: MockMode = MokkeryCompilerDefaults.mockMode, block: MockMany3<T1, T2, T3>.() -> Unit = { }): MockMany3<T1, T2, T3>

Provides mock implementation of T1, T2 and T3.

inline fun <T1 : Any, T2 : Any, T3 : Any, T4 : Any> mockMany(mode: MockMode = MokkeryCompilerDefaults.mockMode, block: MockMany4<T1, T2, T3, T4>.() -> Unit = { }): MockMany4<T1, T2, T3, T4>

Provides mock implementation of T1, T2, T3 and T4.

inline fun <T1 : Any, T2 : Any, T3 : Any, T4 : Any, T5 : Any> mockMany(mode: MockMode = MokkeryCompilerDefaults.mockMode, block: MockMany5<T1, T2, T3, T4, T5>.() -> Unit = { }): MockMany5<T1, T2, T3, T4, T5>

Provides mock implementation of T1, T2, T3, T4 and T5.

Link copied to clipboard
fun resetAnswers(vararg mocks: Any)

Removes all answers configured for given mocks.

Link copied to clipboard
fun resetCalls(vararg mocks: Any)

Clears call history for all given mocks.

Link copied to clipboard
inline fun <T : Any> spy(obj: T, block: T.() -> Unit = { }): T

Returns given obj wrapped with a spying implementation of T.

Link copied to clipboard
fun verify(mode: VerifyMode = MokkeryCompilerDefaults.verifyMode, block: ArgMatchersScope.() -> Unit)

Asserts that calls sequence defined in block satisfies given mode.

Link copied to clipboard
fun verifyNoMoreCalls(vararg mocks: Any)

Asserts that all given mocks have all their registered calls verified with verify or verifySuspend.

Link copied to clipboard
fun verifySuspend(mode: VerifyMode = MokkeryCompilerDefaults.verifyMode, block: suspend ArgMatchersScope.() -> Unit)

Just like verify, but allows suspendable function calls.