open class MockMavericksViewModelConfigFactory : MavericksViewModelConfigFactory
MockMavericksViewModelConfigFactory(applicationContext: Context?, debugMode: Boolean = true, viewModelCoroutineContext: CoroutineContext = EmptyCoroutineContext, stateStoreCoroutineContext: CoroutineContext = EmptyCoroutineContext, subscriptionCoroutineContextOverride: CoroutineContext = EmptyCoroutineContext) |
val currentConfigs: Map<MavericksStateStore<*>, MockableMavericksViewModelConfig<*>> |
|
var mockBehavior: MockBehavior
Determines what sort of mocked state store is created when provideConfig is called. This can be changed via withMockBehavior to affect behavior when creating a new Fragment. |
fun addOnExecuteListener(listener: (MavericksViewModelConfig<*>, MavericksViewModel<*>, BlockExecutions) -> Unit): Unit
Add a lambda that will be invoked whenever MavericksViewModel.execute is used. |
|
open fun <S : MavericksState> buildConfig(viewModel: MavericksViewModel<S>, initialState: S): MavericksViewModelConfig<S> |
|
fun popMockBehaviorOverride(): Unit |
|
fun pushMockBehaviorOverride(mockBehavior: MockBehavior): Unit
Changes the current MockBehavior of all running ViewModels, if they were created when mockBehavior was non null. This forces the mock behavior to this new value. fun pushMockBehaviorOverride(behaviorChange: (currentBehavior: MockBehavior) -> MockBehavior): Unit |
|
fun removeOnExecuteListener(listener: (MavericksViewModelConfig<*>, MavericksViewModel<*>, BlockExecutions) -> Unit): Unit |
|
fun <R> withMockBehavior(mockBehavior: MockBehavior = this.mockBehavior, block: () -> R): R
Any view models created within the block will be given a viewmodel store that was created according to the rules of the given mock behavior. The default value may have been set by a wrapping call to withMockBehavior (ie if multiple calls to withMockBehavior are nested the most recent call can change the behavior of the outer call) |