ConfigurationHelper { public Boolean getBooleanProperty(ConfigurationValue configurationValue) { return getBooleanProperty(configurationValue, environment); }  static String getProperty(ConfigurationValue configurationValue, Environment environment); static T getProperty(ConfigurationValue configurationValue, Class<T> targetType, Environment environment); BigDecimal getBigDecimalRequiredProperty(ConfigurationValue configurationValue); BigDecimal getBigDecimalRequiredProperty(ConfigurationValue configurationValue, Environment environment); Boolean getBooleanProperty(ConfigurationValue configurationValue); Boolean getBooleanProperty(ConfigurationValue configurationValue, Environment environment); BigDecimal getNonNegativeBigDecimalRequiredProperty(ConfigurationValue configurationValue); BigDecimal getNonNegativeBigDecimalRequiredProperty(ConfigurationValue configurationValue, Environment environment); String getProperty(ConfigurationValue configurationValue); T getProperty(ConfigurationValue configurationValue, Class<T> targetType); String getPropertyAsString(ConfigurationValue configurationValue); String getRequiredProperty(ConfigurationValue configurationValue); String getRequiredProperty(ConfigurationValue configurationValue, Environment environment);  }
@Test public void testGetBooleanPropertyValue() { ConfigurationValue configurationValue = ConfigurationValue.USER_NAMESPACE_AUTHORIZATION_ENABLED; MockEnvironment environment = new MockEnvironment(); environment.setProperty(configurationValue.getKey(), "true"); assertEquals(Boolean.TRUE, configurationHelper.getBooleanProperty(configurationValue, environment)); }
@Test public void testGetBooleanPropertyValueConversionFails() { ConfigurationValue configurationValue = ConfigurationValue.USER_NAMESPACE_AUTHORIZATION_ENABLED; MockEnvironment environment = new MockEnvironment(); environment.setProperty(configurationValue.getKey(), "NOT_A_BOOLEAN"); try { configurationHelper.getBooleanProperty(configurationValue, environment); fail("Should throw an IllegalStatueException when property value is not boolean."); } catch (IllegalStateException e) { assertEquals(String.format("Configuration \"%s\" has an invalid boolean value: \"NOT_A_BOOLEAN\".", configurationValue.getKey()), e.getMessage()); } }
@Test public void testGetBooleanPropertyValidationThrowsWhenConfigurationValueIsNull() { try { configurationHelper.getBooleanProperty(null); fail("Should throw an IllegalStateException when configuration value is null."); } catch (IllegalStateException e) { assertEquals("configurationValue is required", e.getMessage()); } }