Class ConfigurationRule<T>
java.lang.Object
org.junit.rules.ExternalResource
de.hybris.platform.integrationservices.util.ConfigurationRule<T>
- All Implemented Interfaces:
org.junit.rules.TestRule
public class ConfigurationRule<T>
extends org.junit.rules.ExternalResource
A test rule that automatically restores configuration changes done by the tests.
IMPORTANT: this rule can only manage beans written in Java. It fails to manage beans, for example, written in Groovy.
IMPORTANT: this rule can only manage beans written in Java. It fails to manage beans, for example, written in Groovy.
-
Method Summary
Modifier and TypeMethodDescriptionprotected voidafter()static <C> ConfigurationRule<C>createFor(C bean) Creates a configuration rule for managing changes on the specified Java Bean instance.static <C> ConfigurationRule<C>Creates a configuration rule for managing configuration parameters changes on the specified Spring bean.Intercepts invocations to the configuration managed by this rule.Methods inherited from class org.junit.rules.ExternalResource
apply, before
-
Method Details
-
createFor
Creates a configuration rule for managing configuration parameters changes on the specified Spring bean.- Type Parameters:
C- class of the bean managed by this rule.- Parameters:
beanId- ID of the Spring Bean to be managed by this rule.type- type of the Spring Bean to be managed by this rule.- Returns:
- a rule that automatically restores any settings changed on the Spring Bean.
-
createFor
Creates a configuration rule for managing changes on the specified Java Bean instance.- Type Parameters:
C- class of the bean managed by this rule.- Parameters:
bean- a Java Bean to manage changes for.- Returns:
- a rule that automatically restores any settings changed on the Java Bean.
-
configuration
-
intercept
Intercepts invocations to the configuration managed by this rule.- Parameters:
method- method being called on the configuration object.values- parameters passed into the method.- Returns:
- value returned by the configuration method being called.
-
after
protected void after()- Overrides:
afterin classorg.junit.rules.ExternalResource
-