use of cn.taketoday.core.env.Environment in project today-infrastructure by TAKETODAY.
the class DefaultConfigurationPropertySourcesTests method shouldFlattenEnvironment.
@Test
void shouldFlattenEnvironment() {
StandardEnvironment environment = new StandardEnvironment();
environment.getPropertySources().addFirst(new MapPropertySource("foo", Collections.singletonMap("foo", "bar")));
environment.getPropertySources().addFirst(new MapPropertySource("far", Collections.singletonMap("far", "far")));
PropertySources sources = new PropertySources();
sources.addFirst(new PropertySource<Environment>("env", environment) {
@Override
public String getProperty(String key) {
return this.source.getProperty(key);
}
});
sources.addLast(new MapPropertySource("baz", Collections.singletonMap("baz", "barf")));
DefaultConfigurationPropertySources configurationSources = new DefaultConfigurationPropertySources(sources);
assertThat(configurationSources.iterator()).toIterable().hasSize(5);
}
Aggregations