Package org.robolectric.plugins
Class LazyApplicationConfigurer
java.lang.Object
org.robolectric.plugins.LazyApplicationConfigurer
- All Implemented Interfaces:
Configurer<LazyApplication.LazyLoad>
@AutoService(Configurer.class)
public class LazyApplicationConfigurer
extends Object
implements Configurer<LazyApplication.LazyLoad>
A
Configurer
that reads the LazyApplication
to
dictate whether Robolectric should lazily instantiate the Application under test (as well as the
test Instrumentation).-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the default configuration for tests that do not specify a configuration of this type.Retrieve the class type for this ConfigurergetConfigFor
(Class<?> testClass) Returns the configuration for the given class.getConfigFor
(Method method) Returns the configuration for the given method.getConfigFor
(String packageName) Returns the configuration for a given package.merge
(LazyApplication.LazyLoad parentConfig, LazyApplication.LazyLoad childConfig) "Merges" two configurations together.
-
Constructor Details
-
LazyApplicationConfigurer
public LazyApplicationConfigurer()
-
-
Method Details
-
getConfigClass
Description copied from interface:Configurer
Retrieve the class type for this Configurer- Specified by:
getConfigClass
in interfaceConfigurer<LazyApplication.LazyLoad>
-
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 interfaceConfigurer<LazyApplication.LazyLoad>
-
getConfigFor
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 interfaceConfigurer<LazyApplication.LazyLoad>
- 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
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 interfaceConfigurer<LazyApplication.LazyLoad>
- Returns:
- a configuration object, or null if the given class has no relevant data for this configuration
-
getConfigFor
Description copied from interface:Configurer
Returns the configuration for the given method.- Specified by:
getConfigFor
in interfaceConfigurer<LazyApplication.LazyLoad>
- Returns:
- a configuration object, or null if the given method has no relevant data for this configuration
-
merge
@Nonnull public LazyApplication.LazyLoad merge(@Nonnull LazyApplication.LazyLoad parentConfig, @Nonnull LazyApplication.LazyLoad childConfig) "Merges" two configurations together. Child configuration always overrides the parent- Specified by:
merge
in interfaceConfigurer<LazyApplication.LazyLoad>
- Parameters:
parentConfig
- a less specific configuration objectchildConfig
- a more specific configuration object- Returns:
- the new configuration with merged parent and child data.
-