mockspresso-extend / com.episode6.hackit.mockspresso.extend / AbstractMockspressoExtension

AbstractMockspressoExtension

abstract class AbstractMockspressoExtension<BLDR : MockspressoExtension.Builder<MockspressoExtension<*>!, MockspressoExtension.Rule<*>!, MockspressoExtension.Builder<*, *, *>!>!> : MockspressoExtension<BLDR>

Extend these 3 classes to create your own mockspresso extension AbstractMockspressoExtension AbstractMockspressoExtension.Rule AbstractMockspressoExtension.Builder In each subclass, point the generic type references to your interface extensions of MockspressoExtension and its inner interfaces. Each subclass should also directly implement the appropriate interface extension of MockspressoExtension In the subclass of AbstractMockspressoExtension, you should only need to override the constructor, providing a lambda that wraps Mockspresso.Builder with your custom subclass of AbstractMockspressoExtension.Builder

Types

Builder

abstract class Builder<EXT : MockspressoExtension<MockspressoExtension.Builder<*, *, *>!>!, RULE : MockspressoExtension.Rule<MockspressoExtension.Builder<*, *, *>!>!, BLDR : MockspressoExtension.Builder<MockspressoExtension<*>!, MockspressoExtension.Rule<*>!, MockspressoExtension.Builder<*, *, *>!>!> : MockspressoExtension.Builder<EXT, RULE, BLDR>

Extend this abstract class for a custom implementation of the Mockspresso.Builder interface. In this class you will only need to override the constructor, providing lambdas that wrap Mockspresso with your custom subclass of AbstractMockspressoExtension and Mockspresso.Rule with your custom subclass of AbstractMockspressoExtension.Rule. Of course you'll also need to override any custom methods you've added to your api.

Rule

abstract class Rule<BLDR : MockspressoExtension.Builder<MockspressoExtension<*>!, MockspressoExtension.Rule<*>!, MockspressoExtension.Builder<*, *, *>!>!> : MockspressoExtension.Rule<BLDR>

Extend this abstract class for a custom implementation of the Mockspresso.Rule interface. In the subclass of AbstractMockspressoExtension.Rule, you should only need to override the constructor, providing a lambda that wraps Mockspresso.Builder with your custom subclass of AbstractMockspressoExtension.Builder

Wrapper

interface Wrapper<IN : Any!, OUT : Any!>

A simple interface that tells us how wrap a Mockspresso instance with your custom implementation (a subclass of one of these abstract classes.

Constructors

<init>

AbstractMockspressoExtension(delegate: Mockspresso, builderWrapper: AbstractMockspressoExtension.Wrapper<Builder!, BLDR>)

Functions

buildUpon

open fun buildUpon(): BLDR

create

open fun <T : Any!> create(clazz: Class<T>): T
open fun <T : Any!> create(typeToken: TypeToken<T>): T

getDependency

open fun <T : Any!> getDependency(key: DependencyKey<T>): T

inject

open fun inject(instance: Any): Unit
open fun <T : Any!> inject(instance: T, typeToken: TypeToken<T>): Unit