Package com.episode6.mockspresso2.plugins.mockk

Functions

Link copied to clipboard
fun <Error class: unknown class>.fallbackWithMockk(relaxed: Boolean = true, relaxedUnitFun: Boolean = true): <Error class: unknown class>

Use mockk to generate fallback objects for dependencies that are not present in the mockspresso instance

Link copied to clipboard
inline fun <T> <Error class: unknown class>.mockk(    qualifier: Annotation? = null,     name: String? = null,     relaxed: Boolean = true,     vararg moreInterfaces: KClass<*>,     relaxUnitFun: Boolean = true,     noinline block: T.() -> Unit = {}): <Error class: unknown class>

Add a mockk with the supplied params as a dependency in this mockspresso instance. Mock will be bound with the supplied qualifier annotation. If you need a reference to the mock dependency, consider MockspressoProperties.mockk instead.

inline fun <T> <Error class: unknown class>.mockk(    qualifier: Annotation? = null,     name: String? = null,     relaxed: Boolean = false,     vararg moreInterfaces: KClass<*>,     relaxUnitFun: Boolean = false,     noinline block: T.() -> Unit = {}): Lazy<T>

Add a mockk with the supplied params as a dependency in this mockspresso instance. Mockk will be bound with the supplied qualifier annotation and will be accessible via the returned lazy.

Link copied to clipboard
inline fun <T> <Error class: unknown class>.spyk(    qualifier: Annotation? = null,     name: String? = null,     vararg moreInterfaces: KClass<*>,     recordPrivateCalls: Boolean = false,     noinline block: T.() -> Unit = {}): Lazy<T>

Create a real object of T using mockspresso then wrap it in a spyk. This spy will be part of the mockspresso graph and can be used by other real objects (and then verified in test code).

Link copied to clipboard
inline fun <BIND, IMPL : BIND> <Error class: unknown class>.spykImplOf(    qualifier: Annotation? = null,     name: String? = null,     vararg moreInterfaces: KClass<*>,     recordPrivateCalls: Boolean = false,     noinline block: IMPL.() -> Unit = {}): Lazy<IMPL>

Create a real object of type IMPL using mockspresso then wrap it in a spyk (the object will be bound using type BIND). This spy will be part of the mockspresso graph and can be used by other real objects (and then verified in test code).