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
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic TogglzRuleallDisabled(Class<? extends org.togglz.core.Feature> featureClass) static TogglzRuleallEnabled(Class<? extends org.togglz.core.Feature> featureClass) org.junit.runners.model.Statementapply(org.junit.runners.model.Statement base, org.junit.runner.Description description) static TogglzRule.Buildervoiddisable(org.togglz.core.Feature feature) voidenable(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:
applyin interfaceorg.junit.rules.TestRule
-
disable
public void disable(org.togglz.core.Feature feature) -
enable
public void enable(org.togglz.core.Feature feature)
-