コード例 #1
0
 @Test
 public void testDroolsStrategyDRLFiles() {
   // Given
   FF4j ff4j = new FF4j("ff4j-drl.xml");
   // When
   Assert.assertTrue(ff4j.exist("f1"));
   // Then
   Assert.assertTrue(ff4j.check("f1"));
 }
コード例 #2
0
 private AbstractProperty<?> readProperty(Field field, String propertyName, boolean required) {
   if (!ff4j.getPropertiesStore().exist(propertyName)) {
     if (required) {
       throw new IllegalArgumentException(
           "Cannot autowiring field '"
               + field.getName()
               + "' with FF4J property as"
               + " target property has not been found");
     } else {
       logger.warn("Property '" + propertyName + "' has not been found but not required");
       return null;
     }
   }
   return ff4j.getPropertiesStore().read(propertyName);
 }
コード例 #3
0
 private Feature readFeature(Field field, String featureName, boolean required) {
   if (!ff4j.getFeatureStore().exist(featureName)) {
     if (required) {
       throw new IllegalArgumentException(
           "Cannot autowiring field '"
               + field.getName()
               + "' with FF4J property as"
               + " target feature has not been found");
     } else {
       logger.warn("Feature '" + featureName + "' has not been found but not required");
       return null;
     }
   }
   return ff4j.getFeatureStore().read(featureName);
 }
コード例 #4
0
 /** TDD */
 @Test
 public void testAOPClass() {
   // Given english mode
   Assert.assertTrue(wholeClassFlipping.hello1().startsWith("Hello"));
   Assert.assertTrue(wholeClassFlipping.hello2().startsWith("Big"));
   // when
   ff4j.enable("language-french");
   // Then
   Assert.assertTrue(wholeClassFlipping.hello1().startsWith("Francais"));
   Assert.assertTrue(wholeClassFlipping.hello2().startsWith("Tour"));
 }
コード例 #5
0
 @After
 public void disable() {
   ff4j.disable("language-french");
 }