Annotation Interface TestInstallIn


@Retention(CLASS) @Target(TYPE) public @interface TestInstallIn
An annotation that replaces one or more InstallIn modules with the annotated module in tests.

The annotated class must also be annotated with Module.

Example:


   // Replaces FooModule with FakeFooModule, and installs it into the same component as FooModule.
   @Module
   @TestInstallIn(components = SingletonComponent.class, replaces = FooModule.class)
   public final class FakeFooModule {
     @Provides
     static Foo provideFoo() {
       return new FakeFoo();
     }
   }
 
See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Class<?>[]
    Returns the component(s) into which the annotated module will be installed.
    Class<?>[]
    Returns the
    invalid @link
    InstallIn
    module(s) that the annotated class will replace in tests.
  • Element Details

    • components

      Class<?>[] components
      Returns the component(s) into which the annotated module will be installed.
    • replaces

      Class<?>[] replaces
      Returns the
      invalid @link
      InstallIn
      module(s) that the annotated class will replace in tests.