public class TestableAndroidInjection
AndroidInjection wrapper that allows customizing dependency injection of Activity or Fragment.
Important: Methods and properties of this object should be used only for testing purposes.
| Modifier and Type | Field and Description |
|---|---|
static TestableAndroidInjection |
INSTANCE
AndroidInjection wrapper that allows customizing dependency injection of Activity or Fragment.
|
| Modifier and Type | Method and Description |
|---|---|
kotlin.jvm.functions.Function1<android.app.Activity,kotlin.Unit> |
getOnActivityInject()
|
kotlin.jvm.functions.Function1<androidx.fragment.app.Fragment,kotlin.Unit> |
getOnFragmentInject()
Callback invoked when Fragment class is being injected.
It should be used in tests for manual dependency injection of Fragment class.
|
void |
inject(android.app.Activity activity)
Wrap AndroidInjection.inject method with helpful utilities for better testability of Activity class.
|
void |
inject(androidx.fragment.app.Fragment fragment)
Wrap AndroidInjection.inject method with helpful utilities for better testability of Fragment class.
|
void |
setOnActivityInject(kotlin.jvm.functions.Function1<? super android.app.Activity,kotlin.Unit> p)
|
void |
setOnFragmentInject(kotlin.jvm.functions.Function1<? super androidx.fragment.app.Fragment,kotlin.Unit> p)
Callback invoked when Fragment class is being injected.
It should be used in tests for manual dependency injection of Fragment class.
|
public static TestableAndroidInjection INSTANCE
AndroidInjection wrapper that allows customizing dependency injection of Activity or Fragment.
Important: Methods and properties of this object should be used only for testing purposes.
@Nullable public kotlin.jvm.functions.Function1<android.app.Activity,kotlin.Unit> getOnActivityInject()
public void setOnActivityInject(@Nullable
kotlin.jvm.functions.Function1<? super android.app.Activity,kotlin.Unit> p)
@Nullable public kotlin.jvm.functions.Function1<androidx.fragment.app.Fragment,kotlin.Unit> getOnFragmentInject()
Callback invoked when Fragment class is being injected. It should be used in tests for manual dependency injection of Fragment class.
The most common use case is to replace ViewModelCreator.viewModelFactory with the factory that provides a view model with mocked use cases
public void setOnFragmentInject(@Nullable
kotlin.jvm.functions.Function1<? super androidx.fragment.app.Fragment,kotlin.Unit> p)
Callback invoked when Fragment class is being injected. It should be used in tests for manual dependency injection of Fragment class.
The most common use case is to replace ViewModelCreator.viewModelFactory with the factory that provides a view model with mocked use cases
public void inject(@NotNull
android.app.Activity activity)
Wrap AndroidInjection.inject method with helpful utilities for better testability of Activity class.
Use] onActivityInject to customize behavior of this method in tests.
onActivityInjectpublic void inject(@NotNull
androidx.fragment.app.Fragment fragment)
Wrap AndroidInjection.inject method with helpful utilities for better testability of Fragment class.
Use onFragmentInject to customize behavior of this method in tests.
onFragmentInject