Package org.togglz.junit
Class TogglzRule
- java.lang.Object
-
- org.togglz.junit.TogglzRule
-
- All Implemented Interfaces:
org.junit.rules.TestRule
public class TogglzRule extends Object implements 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 Modifier and Type Class Description static class
TogglzRule.Builder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static 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
builder(Class<? extends org.togglz.core.Feature> featuresClass)
void
disable(org.togglz.core.Feature feature)
void
enable(org.togglz.core.Feature feature)
-
-
-
Method Detail
-
builder
public static TogglzRule.Builder builder(Class<? extends org.togglz.core.Feature> featuresClass)
-
allEnabled
public static TogglzRule allEnabled(Class<? extends org.togglz.core.Feature> featureClass)
-
allDisabled
public static TogglzRule allDisabled(Class<? extends org.togglz.core.Feature> featureClass)
-
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)
-
-