16 package org.openkilda.config.provider;
18 import static org.junit.Assert.assertEquals;
20 import com.sabre.oss.conf4j.annotation.Configuration;
21 import com.sabre.oss.conf4j.annotation.Key;
22 import com.sabre.oss.conf4j.factory.jdkproxy.JdkProxyStaticConfigurationFactory;
23 import com.sabre.oss.conf4j.source.PropertiesConfigurationSource;
24 import org.junit.Rule;
25 import org.junit.Test;
26 import org.junit.rules.ExpectedException;
28 import java.util.Properties;
29 import javax.validation.constraints.Min;
32 static final String TEST_KEY =
"test_key";
33 static final int VALID_TEST_VALUE = 100;
34 static final int INVALID_TEST_VALUE = -1;
42 Properties
source =
new Properties();
43 source.setProperty(TEST_KEY, String.valueOf(VALID_TEST_VALUE));
46 new PropertiesConfigurationSource(
source),
new JdkProxyStaticConfigurationFactory());
52 assertEquals(VALID_TEST_VALUE,
config.getTestProperty());
58 Properties
source =
new Properties();
59 source.setProperty(TEST_KEY, String.valueOf(INVALID_TEST_VALUE));
62 new PropertiesConfigurationSource(
source),
new JdkProxyStaticConfigurationFactory());
void shouldFailValidationForInvalidConfig()
ExpectedException expectedException
void shouldPassValidationForValidConfig()