Search in sources :

Example 1 with ReleaseDateFlipStrategy

use of org.ff4j.strategy.time.ReleaseDateFlipStrategy in project ff4j by ff4j.

the class ReleaseDateFlipStrategyTest method testInvalidDate.

@Test(expected = IllegalArgumentException.class)
public void testInvalidDate() {
    ReleaseDateFlipStrategy rds2 = new ReleaseDateFlipStrategy(new Date());
    Map<String, String> params = new HashMap<String, String>();
    params.put("releaseDate", "invalid");
    rds2.init("f1", params);
}
Also used : HashMap(java.util.HashMap) ReleaseDateFlipStrategy(org.ff4j.strategy.time.ReleaseDateFlipStrategy) Date(java.util.Date) Test(org.junit.Test) AbstractFf4jTest(org.ff4j.test.AbstractFf4jTest)

Example 2 with ReleaseDateFlipStrategy

use of org.ff4j.strategy.time.ReleaseDateFlipStrategy in project ff4j by ff4j.

the class ReleaseDateFlipStrategyTest method testFutureOK.

@Test
public void testFutureOK() throws ParseException {
    Feature f = ff4j.getFeature("future1");
    ReleaseDateFlipStrategy rds = (ReleaseDateFlipStrategy) f.getFlippingStrategy();
    Assert.assertFalse(rds.evaluate("future1", null, null));
}
Also used : ReleaseDateFlipStrategy(org.ff4j.strategy.time.ReleaseDateFlipStrategy) Feature(org.ff4j.core.Feature) Test(org.junit.Test) AbstractFf4jTest(org.ff4j.test.AbstractFf4jTest)

Example 3 with ReleaseDateFlipStrategy

use of org.ff4j.strategy.time.ReleaseDateFlipStrategy in project ff4j by ff4j.

the class ReleaseDateFlipStrategyTest method testPastDayOK.

@Test
public void testPastDayOK() throws ParseException {
    Feature f = ff4j.getFeature("past1");
    ReleaseDateFlipStrategy rds = (ReleaseDateFlipStrategy) f.getFlippingStrategy();
    Assert.assertTrue(rds.evaluate("past1", null, null));
}
Also used : ReleaseDateFlipStrategy(org.ff4j.strategy.time.ReleaseDateFlipStrategy) Feature(org.ff4j.core.Feature) Test(org.junit.Test) AbstractFf4jTest(org.ff4j.test.AbstractFf4jTest)

Example 4 with ReleaseDateFlipStrategy

use of org.ff4j.strategy.time.ReleaseDateFlipStrategy in project ff4j by ff4j.

the class ReleaseDateFlipStrategyTest method testInitProgrammatically.

@Test
public void testInitProgrammatically() {
    new ReleaseDateFlipStrategy("2016-01-01-12:00");
    ReleaseDateFlipStrategy rds2 = new ReleaseDateFlipStrategy(new Date());
    rds2.setReleaseDate(new Date());
}
Also used : ReleaseDateFlipStrategy(org.ff4j.strategy.time.ReleaseDateFlipStrategy) Date(java.util.Date) Test(org.junit.Test) AbstractFf4jTest(org.ff4j.test.AbstractFf4jTest)

Aggregations

ReleaseDateFlipStrategy (org.ff4j.strategy.time.ReleaseDateFlipStrategy)4 AbstractFf4jTest (org.ff4j.test.AbstractFf4jTest)4 Test (org.junit.Test)4 Date (java.util.Date)2 Feature (org.ff4j.core.Feature)2 HashMap (java.util.HashMap)1