Class LooperModeConfigurer

java.lang.Object
org.robolectric.plugins.LooperModeConfigurer
All Implemented Interfaces:
Configurer<LooperMode.Mode>

@AutoService(Configurer.class) public class LooperModeConfigurer extends Object implements Configurer<LooperMode.Mode>
Provides configuration to Robolectric for its @LooperMode annotation.
  • Constructor Details

    • LooperModeConfigurer

      public LooperModeConfigurer(Properties systemProperties)
  • Method Details

    • getConfigClass

      public Class<LooperMode.Mode> getConfigClass()
      Description copied from interface: Configurer
      Retrieve the class type for this Configurer
      Specified by:
      getConfigClass in interface Configurer<LooperMode.Mode>
    • defaultConfig

      @Nonnull public LooperMode.Mode defaultConfig()
      Description copied from interface: Configurer
      Returns the default configuration for tests that do not specify a configuration of this type.
      Specified by:
      defaultConfig in interface Configurer<LooperMode.Mode>
    • getConfigFor

      public LooperMode.Mode getConfigFor(@Nonnull String packageName)
      Description copied from interface: Configurer
      Returns the configuration for a given package.

      This method will be called once for package in the hierarchy leading to the test class being configured. For example, for com.example.FooTest, this method will be called three times with "com.example", "@com", and "" (representing the top level package).

      Specified by:
      getConfigFor in interface Configurer<LooperMode.Mode>
      Parameters:
      packageName - the name of the package, or the empty string representing the top level unnamed package
      Returns:
      a configuration object, or null if the given properties has no relevant data for this configuration
    • getConfigFor

      public LooperMode.Mode getConfigFor(@Nonnull Class<?> testClass)
      Description copied from interface: Configurer
      Returns the configuration for the given class.

      This method will be called for each class in the test's class inheritance hierarchy.

      Specified by:
      getConfigFor in interface Configurer<LooperMode.Mode>
      Returns:
      a configuration object, or null if the given class has no relevant data for this configuration
    • getConfigFor

      public LooperMode.Mode getConfigFor(@Nonnull Method method)
      Description copied from interface: Configurer
      Returns the configuration for the given method.
      Specified by:
      getConfigFor in interface Configurer<LooperMode.Mode>
      Returns:
      a configuration object, or null if the given method has no relevant data for this configuration
    • merge

      @Nonnull public LooperMode.Mode merge(@Nonnull LooperMode.Mode parentConfig, @Nonnull LooperMode.Mode childConfig)
      Description copied from interface: Configurer
      Merges two configurations. This method will called whenever Configurer.getConfigFor(java.lang.String) returns a non-null configuration object.
      Specified by:
      merge in interface Configurer<LooperMode.Mode>
      Parameters:
      parentConfig - a less specific configuration object
      childConfig - a more specific configuration object
      Returns:
      the new configuration with merged parent and child data.