T
- the configuration object's typeConfigConfigurer
, GetInstallerPackageNameModeConfigurer
, LooperModeConfigurer
, TextLayoutModeConfigurer
public interface Configurer<T>
The test author can apply configuration data at a package, class, or method level, or any combination of those.
The implementation of the configurer determines how config information is collected and merged for each test.
For the test:
class com.foo.MyTest extends com.foo.BaseTest { @Test void testMethod() {} }
the configuration is applied in the following order:
defaultConfig()
Configuration objects can be accessed by shadows or tests via ConfigurationRegistry.get(Class)
.
Modifier and Type | Method | Description |
---|---|---|
T |
defaultConfig() |
Returns the default configuration for tests that do not specify a configuration of this type.
|
Class<T> |
getConfigClass() |
Retrieve the class type for this Configurer
|
T |
getConfigFor(Class<?> testClass) |
Returns the configuration for the given class.
|
T |
getConfigFor(Method method) |
Returns the configuration for the given method.
|
T |
getConfigFor(String packageName) |
Returns the configuration for a given package.
|
T |
merge(T parentConfig,
T childConfig) |
Merges two configurations.
|
@Nonnull T defaultConfig()
T getConfigFor(@Nonnull String packageName)
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).
packageName
- the name of the package, or the empty string representing the top level
unnamed packageT getConfigFor(@Nonnull Class<?> testClass)
This method will be called for each class in the test's class inheritance hierarchy.
T getConfigFor(@Nonnull Method method)
@Nonnull T merge(@Nonnull T parentConfig, @Nonnull T childConfig)
getConfigFor(java.lang.String)
returns a non-null configuration object.parentConfig
- a less specific configuration objectchildConfig
- a more specific configuration object