@Target(value=TYPE)
public @interface UninstallModules
InstallIn
.
This feature should only be used in tests. It is useful for replacing production bindings with fake bindings. The basic idea is to allow users to uninstall the module that provided the production binding so that a fake binding can be provided by the test.
Example:
@HiltAndroidTest
@UninstallModules({
ProdFooModule.class,
})
public class MyTest {
@Module
@InstallIn(SingletonComponent.class)
interface FakeFooModule {
@Binds Foo bindFoo(FakeFoo fakeFoo);
}
}
Modifier and Type | Optional Element and Description |
---|---|
java.lang.Class<?>[] |
value
Returns the list of classes to uninstall.
|
public abstract java.lang.Class<?>[] value
These classes must be annotated with both Module
and InstallIn
.
Note:A module that is included as part of another module's Module.includes()
cannot be truly uninstalled until the including module is also uninstalled.