open class MockMavericksViewModelConfigFactory : MavericksViewModelConfigFactory
context - The application context. If provided this will be used to register a
ViewModelStatePrinter for each ViewModel to enable mock state printing.
MockMavericksViewModelConfigFactory(context: Context?, debugMode: Boolean = true) |
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. |
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 <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) |