use of org.ff4j.test.AssertFf4j in project ff4j by ff4j.
the class SampleServiceFeatureTest method testAOP.
@Test
public void testAOP() {
// Given
ff4j.createFeature("AwesomeFeature", true);
assertFF4j = new AssertFf4j(ff4j);
assertFF4j.assertThatFeatureExist("AwesomeFeature");
assertFF4j.assertThatFeatureIsEnabled("AwesomeFeature");
// When feature is enabled
String result1 = sample.someAwesomeFeature("HELLO");
// Then it works as expected
Assert.assertEquals("HELLO", result1);
// When feature is disabled, nothing and return null
ff4j.disable("AwesomeFeature");
// Then
Assert.assertNull(sample.someAwesomeFeature("HELLO"));
}
use of org.ff4j.test.AssertFf4j in project ff4j by ff4j.
the class SecuredFF4JResourceTestIT method setUp.
/**
* {@inheritDoc}
*/
@Override
@Before
public void setUp() throws Exception {
super.setUp();
// Bridge security between ff4j and jersey
ff4j.setAuthorizationsManager(new FF4JSecurityContextAuthenticationManager());
if (assertFF4J == null) {
assertFF4J = new AssertFf4j(ff4j);
}
}
use of org.ff4j.test.AssertFf4j in project ff4j by ff4j.
the class CoreFeatureStoreTestSupport method setUp.
/**
* {@inheritDoc}
*/
@Before
public void setUp() throws Exception {
ff4j = new FF4j();
FeatureStore fs = initStore();
ff4j.setFeatureStore(fs);
testedStore = fs;
assertFf4j = new AssertFf4j(ff4j);
}
use of org.ff4j.test.AssertFf4j in project ff4j by ff4j.
the class FF4JMBeanTest method setUp.
@Before
public void setUp() throws Exception {
openJmxConnection();
assertFF4J = new AssertFf4j(ff4j);
}
use of org.ff4j.test.AssertFf4j in project ff4j by ff4j.
the class AssertTest method initFF4J.
@Before
public void initFF4J() {
if (assertFF4j == null) {
ff4j = new FF4j();
ff4j.setFeatureStore(new InMemoryFeatureStore("test-ff4j-features.xml"));
ff4j.setPropertiesStore(new InMemoryPropertyStore("test-ff4j-features.xml"));
ff4j.setAuthorizationsManager(new DefaultAuthorisationManager(Util.set("PERM1", "PERM2"), Util.set("PERM1", "PERM2", "PERM3")));
assertFF4j = new AssertFf4j(ff4j);
}
}
Aggregations