ConfigurationOption { public String getValueAsString() { return optionValue.valueAsString; } private  ConfigurationOption(boolean dynamic, boolean sensitive, String key, String label, String description,
								T defaultValue, String configurationCategory, final ValueConverter<T> valueConverter,
								Class<? super T> valueType, List<String> tags, boolean required,
								List<ChangeListener<T>> changeListeners, List<Validator<T>> validators,
								List<String> aliasKeys, final Map<String, String> validOptions); static ConfigurationOptionBuilder<T> builder(ValueConverter<T> valueConverter, Class<? super T> valueType); static ConfigurationOptionBuilder<String> stringOption(); static ConfigurationOptionBuilder<T> jsonOption(TypeReference<T> typeReference, Class<? super T> clazz); static ConfigurationOptionBuilder<Boolean> booleanOption(); static ConfigurationOptionBuilder<Integer> integerOption(); static ConfigurationOptionBuilder<Long> longOption(); static ConfigurationOptionBuilder<Double> doubleOption(); static ConfigurationOptionBuilder<Collection<String>> stringsOption(); static ConfigurationOptionBuilder<Collection<String>> lowerStringsOption(); static ConfigurationOption.ConfigurationOptionBuilder<Collection<Integer>> integersOption(); static ConfigurationOptionBuilder<Collection<Pattern>> regexListOption(); static ConfigurationOptionBuilder<Map<Pattern, String>> regexMapOption(); static ConfigurationOptionBuilder<Map<K, V>> mapOption(ValueConverter<K> keyConverter, ValueConverter<V> valueConverter); static ConfigurationOptionBuilder<T> enumOption(Class<T> clazz); static ConfigurationOptionBuilder<T> serviceLoaderStrategyOption(Class<T> serviceLoaderInterface); static ConfigurationOptionBuilder<URL> urlOption(); static ConfigurationOptionBuilder<List<URL>> urlsOption(); boolean isDynamic(); String getKey(); List<String> getAliasKeys(); String getLabel(); String getDescription(); String getDefaultValueAsString(); String getValueAsString(); String getValueAsSafeString(); boolean isSensitive(); @JsonIgnore T getValue(); @JsonIgnore T get(); @JsonIgnore OptionValue<T> getOptionValue(); String getNameOfCurrentConfigurationSource(); String getConfigurationCategory(); List<String> getTags(); String getValueType(); ValueConverter<T> getValueConverter(); String getErrorMessage(); Collection<String> getValidOptions(); Map<String, String> getValidOptionsLabelMap(); void assertValid(String valueAsString); void update(T newValue, String configurationSourceName); boolean isDefault(); void addChangeListener(ChangeListener<T> changeListener); boolean removeChangeListener(ChangeListener<T> changeListener); String getUsedKey();  }
@Test public void testAlternateKeysPrimary() { final ConfigurationRegistry configuration = createConfiguration(Collections.singletonList(testAlternateKeys), SimpleSource.forTest("primaryKey", "foo")); assertEquals("foo", configuration.getConfigurationOptionByKey("primaryKey").getValueAsString()); assertEquals("foo", configuration.getConfigurationOptionByKey("alternateKey1").getValueAsString()); assertEquals("foo", configuration.getConfigurationOptionByKey("alternateKey2").getValueAsString()); }
@Test public void testAlternateKeysAlternate() { final ConfigurationRegistry configuration = createConfiguration(Collections.singletonList(testAlternateKeys), SimpleSource.forTest("alternateKey1", "foo")); assertEquals("foo", configuration.getConfigurationOptionByKey("primaryKey").getValueAsString()); assertEquals("foo", configuration.getConfigurationOptionByKey("alternateKey1").getValueAsString()); assertEquals("foo", configuration.getConfigurationOptionByKey("alternateKey2").getValueAsString()); }
@Test public void testAlternateKeysPrimaryAndAlternate() { final ConfigurationRegistry configuration = createConfiguration(Collections.singletonList(testAlternateKeys), SimpleSource.forTest("primaryKey", "foo").add("alternateKey1", "bar")); assertEquals("foo", configuration.getConfigurationOptionByKey("primaryKey").getValueAsString()); assertEquals("foo", configuration.getConfigurationOptionByKey("alternateKey1").getValueAsString()); assertEquals("foo", configuration.getConfigurationOptionByKey("alternateKey2").getValueAsString()); }