|
|
@ -16,6 +16,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
package org.springframework.boot.context.properties.source;
|
|
|
|
package org.springframework.boot.context.properties.source;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
|
|
|
|
|
|
|
import org.junit.Test;
|
|
|
|
import org.junit.Test;
|
|
|
|
import org.mockito.Answers;
|
|
|
|
import org.mockito.Answers;
|
|
|
|
|
|
|
|
|
|
|
@ -111,6 +113,16 @@ public class AliasedConfigurationPropertySourceTests {
|
|
|
|
.isEqualTo(ConfigurationPropertyState.PRESENT);
|
|
|
|
.isEqualTo(ConfigurationPropertyState.PRESENT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void containsDescendantOfWhenPresentInAliasShouldReturnPresent() {
|
|
|
|
|
|
|
|
ConfigurationPropertySource source = new MapConfigurationPropertySource(
|
|
|
|
|
|
|
|
Collections.singletonMap("foo.bar", "foobar"));
|
|
|
|
|
|
|
|
ConfigurationPropertySource aliased = source
|
|
|
|
|
|
|
|
.withAliases(new ConfigurationPropertyNameAliases("foo.bar", "baz.foo"));
|
|
|
|
|
|
|
|
assertThat(aliased.containsDescendantOf(ConfigurationPropertyName.of("baz")))
|
|
|
|
|
|
|
|
.isEqualTo(ConfigurationPropertyState.PRESENT);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Object getValue(ConfigurationPropertySource source, String name) {
|
|
|
|
private Object getValue(ConfigurationPropertySource source, String name) {
|
|
|
|
ConfigurationProperty property = source
|
|
|
|
ConfigurationProperty property = source
|
|
|
|
.getConfigurationProperty(ConfigurationPropertyName.of(name));
|
|
|
|
.getConfigurationProperty(ConfigurationPropertyName.of(name));
|
|
|
|