spyk
inline fun <T : Any> spyk( name: String? = null, vararg moreInterfaces: KClass<*>, recordPrivateCalls: Boolean = false, block: T.() -> Unit = {}): T
Content copied to clipboard
Builds a new spy for specified class. Initializes object via default constructor.
A spy is a special kind of mockk that enables a mix of mocked behaviour and real behaviour. A part of the behaviour may be mocked, but any non-mocked behaviour will call the original method.
Parameters
name
spyk name
more Interfaces
additional interfaces for this spyk to implement
record Private Calls
allows this spyk to record any private calls, enabling a verification
block
block to execute after spyk is created with spyk as a receiver
inline fun <T : Any> spyk( objToCopy: T, name: String? = null, vararg moreInterfaces: KClass<*>, recordPrivateCalls: Boolean = false, block: T.() -> Unit = {}): T
Content copied to clipboard
Builds a new spy for specified class, copying fields from objToCopy.
A spy is a special kind of mockk that enables a mix of mocked behaviour and real behaviour. A part of the behaviour may be mocked, but any non-mocked behaviour will call the original method.