mockspresso-api / com.episode6.hackit.mockspresso

Package com.episode6.hackit.mockspresso

Types

Mockspresso

interface Mockspresso

Main mockspresso interface

Functions

createNew

fun <T : Any> Mockspresso.createNew(): T

Create a real object of type T injected with mockspresso dependencies.

dependencyOf

fun <T : Any> Mockspresso.Builder.dependencyOf(qualifier: Annotation? = null, value: () -> T?): Mockspresso.Builder

Apply a specific instance of an object as a mockspresso dependency. Kotlin alias for Mockspresso.Builder.dependencyProvider.

getDependencyOf

fun <T : Any> Mockspresso.getDependencyOf(qualifier: Annotation? = null): T?

Get a dependency (creating a new mock, if needed) from mockspresso.

injectType

fun <T : Any> Mockspresso.injectType(instance: T): Unit

Inject an existing object with mockspresso dependencies. Field and method injection will be performed (assuming the injector of this mockspresso instance supports it). Uses a reified type and includes a TypeToken in the method call, so will work with generics.

realClassOf

fun <BIND_AND_IMPL : Any> Mockspresso.Builder.realClassOf(qualifier: Annotation? = null): Mockspresso.Builder

Instruct mockspresso to create a real object and bind with a dependencyKey of its own concrete type Convenience method for realImplOf when both BIND and IMPL are the same type

realImplOf

fun <BIND : Any, IMPL : BIND> Mockspresso.Builder.realImplOf(qualifier: Annotation? = null): Mockspresso.Builder

Instruct mockspresso to create a real object (of type IMPL) to be bound using a dependency key of type BIND. Kotlin alias for Mockspresso.Builder.realObject