class MockStateHolder
Used to mock the initial state value of a viewmodel.
data class ViewModelDelegateInfo<VM : MavericksViewModel<S>, S : MavericksState> |
MockStateHolder()
Used to mock the initial state value of a viewmodel. |
fun <VM : MavericksViewModel<S>, S : MavericksState> addViewModelDelegate(view: MockableMavericksView, existingViewModel: Boolean, viewModelProperty: KProperty<*>, viewModelDelegate: lifecycleAwareLazy<VM>): Unit |
|
fun clearAllMocks(): Unit |
|
fun clearMock(view: MockableMavericksView): Unit
Clear the stored mock info for the given view. This should be called after the view is done initializing itself with the mock. This should be done to prevent leaking references to the view and its mocks. |
|
fun <S : MavericksState> getMockedState(view: MockableMavericksView, viewModelProperty: KProperty<*>, existingViewModel: Boolean, stateClass: Class<S>, forceMockExistingViewModel: Boolean): S?
Get the mocked state for the viewmodel on the given view. Returns null if no mocked state has been set - this is valid if a view under mock contains nested views that are not under mock. |
|
fun <V : MockableMavericksView, A : Parcelable> setMock(view: MockableMavericksView, mockInfo: MavericksMock<V, A>): Unit
Set mock data for a view reference. The mocks will be used to provide initial state when the view models are initialized as the view is started. |