use of com.sabre.oss.conf4j.source.PropertiesConfigurationSource in project open-kilda by telstra.
the class ValidatingConfigurationProviderTest method shouldPassValidationForValidConfig.
@Test
public void shouldPassValidationForValidConfig() {
// given
Properties source = new Properties();
source.setProperty(TEST_KEY, String.valueOf(VALID_TEST_VALUE));
ValidatingConfigurationProvider provider = new ValidatingConfigurationProvider(new PropertiesConfigurationSource(source), new JdkProxyStaticConfigurationFactory());
// when
TestConfig config = provider.getConfiguration(TestConfig.class);
// then
assertEquals(VALID_TEST_VALUE, config.getTestProperty());
}
use of com.sabre.oss.conf4j.source.PropertiesConfigurationSource in project open-kilda by telstra.
the class ValidatingConfigurationProviderTest method shouldFailValidationForInvalidConfig.
@Test
public void shouldFailValidationForInvalidConfig() {
// given
Properties source = new Properties();
source.setProperty(TEST_KEY, String.valueOf(INVALID_TEST_VALUE));
ValidatingConfigurationProvider provider = new ValidatingConfigurationProvider(new PropertiesConfigurationSource(source), new JdkProxyStaticConfigurationFactory());
// when
expectedException.expect(ConfigurationException.class);
provider.getConfiguration(TestConfig.class);
// then ConfigurationException is thrown
}
Aggregations