|
|
|
|
@ -21,6 +21,7 @@ import java.util.Iterator;
@@ -21,6 +21,7 @@ import java.util.Iterator;
|
|
|
|
|
|
|
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
|
|
|
|
|
|
import org.springframework.boot.env.RandomValuePropertySource; |
|
|
|
|
import org.springframework.core.env.Environment; |
|
|
|
|
import org.springframework.core.env.MapPropertySource; |
|
|
|
|
import org.springframework.core.env.MutablePropertySources; |
|
|
|
|
@ -161,4 +162,15 @@ class SpringConfigurationPropertySourcesTests {
@@ -161,4 +162,15 @@ class SpringConfigurationPropertySourcesTests {
|
|
|
|
|
assertThat(configurationSources.iterator().next().getConfigurationProperty(name).getValue()).isEqualTo("s2"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void shouldNotAdaptRandomePropertySource() { |
|
|
|
|
MutablePropertySources sources = new MutablePropertySources(); |
|
|
|
|
sources.addFirst(new RandomValuePropertySource()); |
|
|
|
|
sources.addFirst(new MapPropertySource("test", Collections.singletonMap("a", "b"))); |
|
|
|
|
Iterator<ConfigurationPropertySource> iterator = new SpringConfigurationPropertySources(sources).iterator(); |
|
|
|
|
ConfigurationPropertyName name = ConfigurationPropertyName.of("a"); |
|
|
|
|
assertThat(iterator.next().getConfigurationProperty(name).getValue()).isEqualTo("b"); |
|
|
|
|
assertThat(iterator.hasNext()).isFalse(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|