Package-level declarations

Types

Link copied to clipboard
interface MockFactory

Creates a mock implementation for given type.

Link copied to clipboard
interface SpyFactory

Creates a spy implementation for given type.

Properties

Link copied to clipboard

Sets default MockMode for currently configured MockFactory.

Functions

Link copied to clipboard
inline fun <T : Any> MockFactory.create(noinline block: MokkeryMockConfigurer.Block<T> = { }): T

Creates a mock of given T and applies the block or fails if T is not supported by this factory.

Creates a mock of given type and applies the block or fails if type is not supported by this factory.

inline fun <T : Any> SpyFactory.create(obj: T, noinline block: MokkerySpyConfigurer.Block<T> = { }): T

Creates a spy of given type T wrapping obj or fails if T is not supported by this factory.

fun SpyFactory.create(type: KType, obj: Any, block: MokkerySpyConfigurer.Block<Any> = { }): Any

Creates a spy of given type wrapping obj or fails if type is not supported by this factory.

Link copied to clipboard
inline fun <T : Any> MockFactory.createOrNull(noinline block: MokkeryMockConfigurer.Block<T> = { }): T?

Creates a mock of given T and applies the block or returns null if T is not supported by this factory.

inline fun <T : Any> SpyFactory.createOrNull(obj: T, noinline block: MokkerySpyConfigurer.Block<T> = { }): T?

Creates a spy of given T wrapping obj and applies the block or returns null if T is not supported by this factory.

Link copied to clipboard
fun mockFactoryOf(vararg classes: KClass<*>, block: MockFactoryConfigurer.Block = { }): MockFactory

Returns a MockFactory that is able to create mocks of given classes.

Link copied to clipboard

Returns a MockFactory that is able to create mocks of given classes. Every mock created by the returned factory is a child of given MokkerySuiteScope.

Link copied to clipboard
operator fun MockFactory.plus(other: MockFactory): MockFactory

Returns a MockFactory that combines this factory with other.

operator fun SpyFactory.plus(other: SpyFactory): SpyFactory

Returns a SpyFactory that combines this factory with other.

Link copied to clipboard
fun spyFactoryOf(vararg classes: KClass<*>, block: SpyFactoryConfigurer.Block = { }): SpyFactory

Returns a SpyFactory that is able to create spies of given classes.

Link copied to clipboard

Returns a SpyFactory that is able to create spies of given classes. Every spy created by the returned factory is a child of given MokkerySuiteScope.