Package org.togglz.junit
Class TogglzRule
java.lang.Object
org.togglz.junit.TogglzRule
- All Implemented Interfaces:
org.junit.rules.TestRule
JUnit rule that simplifies the process of controlling features in unit tests.
Example usage:
public class TogglzRuleAllEnabledTest { @Rule public TogglzRule togglzRule = TogglzRule.allEnabled(MyFeatures.class); @Test public void testToggleFeature() { assertTrue(MyFeatures.FEATURE_ONE.isActive()); togglzRule.disable(MyFeatures.FEATURE_ONE); assertFalse(MyFeatures.FEATURE_ONE.isActive()); } }
- Author:
- Christian Kaltepoth
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic TogglzRule
allDisabled
(Class<? extends org.togglz.core.Feature> featureClass) static TogglzRule
allEnabled
(Class<? extends org.togglz.core.Feature> featureClass) org.junit.runners.model.Statement
apply
(org.junit.runners.model.Statement base, org.junit.runner.Description description) static TogglzRule.Builder
void
disable
(org.togglz.core.Feature feature) void
enable
(org.togglz.core.Feature feature)
-
Method Details
-
builder
-
allEnabled
-
allDisabled
-
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description) - Specified by:
apply
in interfaceorg.junit.rules.TestRule
-
disable
public void disable(org.togglz.core.Feature feature) -
enable
public void enable(org.togglz.core.Feature feature)
-