mvrx-mocking / com.airbnb.mvrx.mocking / MockMavericksViewModelConfigFactory / withMockBehavior

withMockBehavior

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)

After the block has executed, the previous setting for mockBehavior will be used again.

Parameters

mockBehavior - Null to have ViewModels created with a RealMvRxStateFactory. Non null to create ViewModels with a MockableMavericksStateStore If not null, the MockableMavericksStateStore will be created with the options declared in the MockBehavior