-
- All Implemented Interfaces:
-
com.airbnb.mvrx.mocking.DataClassSetDsl
public final class ThreeViewModelMockBuilder<V extends MockableMavericksView, VM1 extends MavericksViewModel<S1>, S1 extends MavericksState, VM2 extends MavericksViewModel<S2>, S2 extends MavericksState, VM3 extends MavericksViewModel<S3>, S3 extends MavericksState, Args extends Parcelable> extends MockBuilder<V, Args>
-
-
Field Summary
Fields Modifier and Type Field Description private final <ERROR CLASS>mocksprivate final List<List<MavericksMock<V, out Args>>>mockGroups
-
Method Summary
Modifier and Type Method Description <ERROR CLASS>getMocks()A list of mocks to use when testing a view. List<List<MavericksMock<V, out Args>>>getMockGroups()final Unitstate(String name, Function1<Args, Args> args, Function1<ThreeStatesBuilder<V, S1, VM1, S2, VM2, S3, VM3>, Unit> statesBuilder)Provide state objects for each view model in the view. final <T extends Any, A extends Async<T>> UnitviewModel1StateForLoadingAndFailure(S1 state, Function1<S1, KProperty0<A>> asyncPropertyBlock)Helper to mock the loading and failure state of an Async property on your state in the first view model. final <T extends Any, A extends Async<T>> UnitviewModel2StateForLoadingAndFailure(S2 state, Function1<S2, KProperty0<A>> asyncPropertyBlock)Helper to mock the loading and failure state of an Async property on your state in the second view model. final <T extends Any, A extends Async<T>> UnitviewModel3StateForLoadingAndFailure(S3 state, Function1<S3, KProperty0<A>> asyncPropertyBlock)Helper to mock the loading and failure state of an Async property on your state in the third view model. -
Methods inherited from class com.airbnb.mvrx.mocking.ThreeViewModelMockBuilder
args -
Methods inherited from class com.airbnb.mvrx.mocking.MockBuilder
invoke, set, setEmpty, setFalse, setLoading, setNetworkFailure, setNull, setTrue, setZero, success, validate, with -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getMocks
<ERROR CLASS> getMocks()
A list of mocks to use when testing a view. Each mock represents a unique state to be tested.
At least one of mocks or mockGroups must be implemented.
-
getMockGroups
List<List<MavericksMock<V, out Args>>> getMockGroups()
-
state
final Unit state(String name, Function1<Args, Args> args, Function1<ThreeStatesBuilder<V, S1, VM1, S2, VM2, S3, VM3>, Unit> statesBuilder)
Provide state objects for each view model in the view.
- Parameters:
name- Describes the UI these states put the view in.args- The arguments that should be provided to the view.statesBuilder- A lambda that is used to define state objects for each view model.
-
viewModel1StateForLoadingAndFailure
final <T extends Any, A extends Async<T>> Unit viewModel1StateForLoadingAndFailure(S1 state, Function1<S1, KProperty0<A>> asyncPropertyBlock)
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.
-
viewModel2StateForLoadingAndFailure
final <T extends Any, A extends Async<T>> Unit viewModel2StateForLoadingAndFailure(S2 state, Function1<S2, KProperty0<A>> asyncPropertyBlock)
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.
-
viewModel3StateForLoadingAndFailure
final <T extends Any, A extends Async<T>> Unit viewModel3StateForLoadingAndFailure(S3 state, Function1<S3, KProperty0<A>> asyncPropertyBlock)
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.
-
-
-
-