mockkOptionalService

@JvmName(name = "mockkOptionalServiceKFunction3")
inline fun <T : AnyIviServiceApiBase> mockkOptionalService(    createApiOrNull: (LifecycleOwner, IviServiceProvider, Any) -> T?,     serviceRegistered: LiveData<Boolean>,     queuedActions: MutableList<() -> Unit> = mutableListOf(),     mockServiceImplementation: T.() -> Unit = {}): T
@JvmName(name = "mockkOptionalServiceKFunction2")
inline fun <T : AnyIviServiceApiBase> mockkOptionalService(    createApiOrNull: (LifecycleOwner, IviServiceProvider) -> T?,     serviceRegistered: LiveData<Boolean>,     queuedActions: MutableList<() -> Unit> = mutableListOf(),     mockServiceImplementation: T.() -> Unit = {}): T

Mocks the IVI service returned by createApiOrNull. This is for services that are optionally registered. For services that are always expected to be registered, use mockkService instead.

Return

A reference to the created service mock. The caller does not need to keep a reference in order to prevent the mock from being garbage collected.

Parameters

T

The type of the service API.

createApiOrNull

A function reference to the createApiOrNull call used by production code to get a reference to the service API.

serviceRegistered

Whether or not the services is considered to be registered. Production code will get null when creating a service API when false.

queuedActions

If IviServiceApiBase.queueOrRunAction is called while the service is not available (IviServiceApiBase.serviceAvailable is false), the lambda given to IviServiceApiBase.queueOrRunAction is added to this list.

mockServiceImplementation

The MockK block for the service mock, containing things like every statements.