Search in sources :

Example 1 with ExpressionFlipStrategy

use of org.ff4j.strategy.el.ExpressionFlipStrategy in project ff4j by ff4j.

the class ExpressionFlipStategyTest method testExplicitevaluate.

@Test
public void testExplicitevaluate() {
    ExpressionFlipStrategy efs = new ExpressionFlipStrategy();
    Assert.assertTrue(efs.evaluate("D", ff4j.getFeatureStore(), null));
    Assert.assertTrue(efs.evaluate("TOTO", ff4j.getFeatureStore(), null));
    FlippingExecutionContext fex = new FlippingExecutionContext();
    fex.putString(ExpressionFlipStrategy.PARAM_EXPRESSION, "D");
    Assert.assertTrue(efs.evaluate("D", ff4j.getFeatureStore(), fex));
    fex.putString(ExpressionFlipStrategy.PARAM_EXPRESSION, "TOTO");
    Assert.assertFalse(efs.evaluate("D", ff4j.getFeatureStore(), fex));
}
Also used : ExpressionFlipStrategy(org.ff4j.strategy.el.ExpressionFlipStrategy) FlippingExecutionContext(org.ff4j.core.FlippingExecutionContext) Test(org.junit.Test)

Example 2 with ExpressionFlipStrategy

use of org.ff4j.strategy.el.ExpressionFlipStrategy in project ff4j by ff4j.

the class FF4jTest method testOverrideStrategy.

@Test
public void testOverrideStrategy() {
    FF4j ff4j = new FF4j();
    ff4j.audit();
    ff4j.createFeature("N1", true, "description NEWS");
    ff4j.createFeature("N2", false, "description NEWS");
    Assert.assertTrue(ff4j.check("N1"));
    Assert.assertFalse(ff4j.checkOveridingStrategy("N1", new ExpressionFlipStrategy("N1", "N1 & N2")));
}
Also used : ExpressionFlipStrategy(org.ff4j.strategy.el.ExpressionFlipStrategy) FF4j(org.ff4j.FF4j) Test(org.junit.Test)

Aggregations

ExpressionFlipStrategy (org.ff4j.strategy.el.ExpressionFlipStrategy)2 Test (org.junit.Test)2 FF4j (org.ff4j.FF4j)1 FlippingExecutionContext (org.ff4j.core.FlippingExecutionContext)1