class ThreeViewModelMockBuilder<V : MockableMavericksView, VM1 : MavericksViewModel<S1>, S1 : MavericksState, VM2 : MavericksViewModel<S2>, S2 : MavericksState, VM3 : MavericksViewModel<S3>, S3 : MavericksState, Args : Parcelable> : MockBuilder<V, Args>
val defaultState1: S1 |
|
val defaultState2: S2 |
|
val defaultState3: S3 |
|
val vm1: KProperty1<V, VM1> |
|
val vm2: KProperty1<V, VM2> |
|
val vm3: KProperty1<V, VM3> |
open val mocks: MutableList<MavericksMock<V, Args>>
A list of mocks to use when testing a view. Each mock represents a unique state to be tested. |
fun state(name: String, args: (Args.() -> Args)? = null, statesBuilder: ThreeStatesBuilder<V, S1, VM1, S2, VM2, S3, VM3>.() -> Unit): Unit
Provide state objects for each view model in the view. |
|
fun <T, A : Async<T>> viewModel1StateForLoadingAndFailure(state: S1 = defaultState1, asyncPropertyBlock: S1.() -> KProperty0<A>): Unit
Helper to mock the loading and failure state of an Async property on your state in the first view model. Creates two different mocked states stemmed from the given state - one where the async property is set to Loading and one where it is set to Fail. |
|
fun <T, A : Async<T>> viewModel2StateForLoadingAndFailure(state: S2 = defaultState2, asyncPropertyBlock: S2.() -> KProperty0<A>): Unit
Helper to mock the loading and failure state of an Async property on your state in the second view model. Creates two different mocked states stemmed from the given state - one where the async property is set to Loading and one where it is set to Fail. |
|
fun <T, A : Async<T>> viewModel3StateForLoadingAndFailure(state: S3 = defaultState3, asyncPropertyBlock: S3.() -> KProperty0<A>): Unit
Helper to mock the loading and failure state of an Async property on your state in the third view model. Creates two different mocked states stemmed from the given state - one where the async property is set to Loading and one where it is set to Fail. |
fun addState(name: String, argsProvider: () -> Args? = { defaultArgs }, statesProvider: () -> List<MockState<V, *>> = { defaultStates }, forInitialization: Boolean = false, type: MavericksMock.Type = MavericksMock.Type.Custom): Unit |
|
fun args(name: String, builder: Args.() -> Args): Unit
Provide an instance of arguments to use when initializing a view and creating initial view model state. It is only valid to call this if you defined default arguments in the top level mock method. For convenience, the receiver of the lambda is the default arguments. |