Class UnitTestFeatureToggler
java.lang.Object
org.junit.rules.ExternalResource
de.hybris.platform.integrationservices.util.featuretoggle.UnitTestFeatureToggler
- All Implemented Interfaces:
org.junit.rules.TestRule
public class UnitTestFeatureToggler
extends org.junit.rules.ExternalResource
A test rule that stubs feature toggle values. This rule should be used with unit tests.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidafter()protected voidbefore()disable()Disables the feature for which this toggler is initialized.enable()Enables the feature for which this toggler is initialized.booleanTo check if the feature is enabled for which this toggler is initialized.Methods inherited from class org.junit.rules.ExternalResource
apply
-
Constructor Details
-
UnitTestFeatureToggler
Initialize the test toggler.- Parameters:
feature- the Feature for which a test toggler is required
-
-
Method Details
-
isEnabled
public boolean isEnabled()To check if the feature is enabled for which this toggler is initialized.- Returns:
trueif feature is enabled, elsefalse.
-
enable
Enables the feature for which this toggler is initialized.- Returns:
- this TestFeatureToggler instance
-
disable
Disables the feature for which this toggler is initialized.- Returns:
- this TestFeatureToggler instance
-
before
protected void before()- Overrides:
beforein classorg.junit.rules.ExternalResource
-
after
protected void after()- Overrides:
afterin classorg.junit.rules.ExternalResource
-