#354 add general boolean method to services for feature status. Change user.toString
This commit is contained in:
@ -8,6 +8,8 @@ import org.junit.Test;
|
||||
import java.util.Properties;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class PropertiesFeatureToggleVersionTest {
|
||||
|
||||
@ -16,6 +18,7 @@ public class PropertiesFeatureToggleVersionTest {
|
||||
final Properties properties = new Properties();
|
||||
properties.put("enhancedWelcome",true);
|
||||
Service service = new PropertiesFeatureToggleVersion(properties);
|
||||
assertTrue(service.isEnhanced());
|
||||
final String welcomeMessage = service.getWelcomeMessage(new User("Jamie No Code"));
|
||||
assertEquals("Welcome Jamie No Code. You're using the enhanced welcome message.",welcomeMessage);
|
||||
}
|
||||
@ -25,6 +28,7 @@ public class PropertiesFeatureToggleVersionTest {
|
||||
final Properties properties = new Properties();
|
||||
properties.put("enhancedWelcome",false);
|
||||
Service service = new PropertiesFeatureToggleVersion(properties);
|
||||
assertFalse(service.isEnhanced());
|
||||
final String welcomeMessage = service.getWelcomeMessage(new User("Jamie No Code"));
|
||||
assertEquals("Welcome to the application.",welcomeMessage);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class TieredFeatureToggleVersionTest {
|
||||
|
||||
@ -33,4 +34,9 @@ public class TieredFeatureToggleVersionTest {
|
||||
final String expected = "I suppose you can use this software.";
|
||||
assertEquals(expected, welcomeMessage);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsEnhancedAlwaysTrueAsTiered() throws Exception {
|
||||
assertTrue(service.isEnhanced());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user