fun <V : MockableMavericksView> getMockVariants(viewClassName: String, viewProvider: (viewClass: Class<V>, argumentsBundle: Bundle?) -> V = { viewClass, argumentsBundle ->
@Suppress("UNCHECKED_CAST")
val view = viewClass.newInstance()
if (view is Fragment) view.arguments = argumentsBundle
view
}, emptyMockPlaceholder: EmptyMavericksViewMocks = EmptyMocks, mockGroupIndex: Int? = null): List<MockedViewProvider<V>>?
See getMockVariants
Provides mocks for the view specified by the fully qualified name of its class.
viewClassName - The fully qualified name of the view's class.
viewProvider - Creates an instance of the view from the view class. The view should be created
with the given arguments bundle if it exists. The bundle contains parcelable arguments under the
Mavericks.KEY_ARG key.
fun <V : MockableMavericksView> getMockVariants(viewClass: Class<V>, viewProvider: (viewClass: Class<V>, argumentsBundle: Bundle?) -> V = { viewClassFromProvider, argumentsBundle ->
@Suppress("UNCHECKED_CAST")
val view = viewClassFromProvider.newInstance()
if (view is Fragment) view.arguments = argumentsBundle
view
}, emptyMockPlaceholder: EmptyMavericksViewMocks = EmptyMocks, mockGroupIndex: Int? = null): List<MockedViewProvider<V>>?
See getMockVariants
Provides mocks for the view specified by the given class.
viewClass - The Java class representing the MavericksView
viewProvider - Creates an instance of the view from the view class. The view should be created
with the given arguments bundle if it exists. The bundle contains parcelable arguments under the
Mavericks.KEY_ARG key.
fun <V : MockableMavericksView, A : Parcelable> getMockVariants(viewProvider: (arguments: A?, argumentsBundle: Bundle?) -> V, emptyMockPlaceholder: EmptyMavericksViewMocks = EmptyMocks, mockGroupIndex: Int? = null): List<MockedViewProvider<V>>?
Get all of the mocks declared for a MavericksView. The returned list of MockedViewProvider has one entry representing each mock in the view, which can be used to create a view mocked with that state and arguments.
viewProvider - Return an instance of the MavericksView that is being mocked. It should be
created with the provided arguments if they exist. Both the arguments and argumentsBundle
parameters in the lambda represent the same arguments, they are just provided in multiple
forms so you can use the most convenient. The Bundle just contains the Parcelable arguments
under the Mavericks.KEY_ARG key.
emptyMockPlaceholder - If you use a custom object to represent that a MavericksView legitimately
has no mocks then specify it here. Otherwise any view with empty mocks will throw an error.
mockGroupIndex - If the mocks are declared with combineMocks then if an index is passed
only the mocks in that group index will be returned. Will throw an error if this is not a valid
group index for this view's mocks.