Commit 1a0f2198 authored by Madhura Bhave's avatar Madhura Bhave

Fix tests

Fixes gh-3832
parent 00430ac2
...@@ -77,7 +77,7 @@ public class NoUnboundElementsBindHandler extends AbstractBindHandler { ...@@ -77,7 +77,7 @@ public class NoUnboundElementsBindHandler extends AbstractBindHandler {
BindContext context) { BindContext context) {
Set<ConfigurationProperty> unbound = new TreeSet<>(); Set<ConfigurationProperty> unbound = new TreeSet<>();
for (ConfigurationPropertySource source : context.getSources()) { for (ConfigurationPropertySource source : context.getSources()) {
if (this.filter.apply(source)) { if (source instanceof IterableConfigurationPropertySource && this.filter.apply(source)) {
collectUnbound(name, unbound, collectUnbound(name, unbound,
(IterableConfigurationPropertySource) source); (IterableConfigurationPropertySource) source);
} }
......
...@@ -48,6 +48,7 @@ import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; ...@@ -48,6 +48,7 @@ import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.MapPropertySource; import org.springframework.core.env.MapPropertySource;
import org.springframework.core.env.MutablePropertySources; import org.springframework.core.env.MutablePropertySources;
import org.springframework.core.env.StandardEnvironment;
import org.springframework.core.env.SystemEnvironmentPropertySource; import org.springframework.core.env.SystemEnvironmentPropertySource;
import org.springframework.mock.env.MockEnvironment; import org.springframework.mock.env.MockEnvironment;
import org.springframework.test.context.support.TestPropertySourceUtils; import org.springframework.test.context.support.TestPropertySourceUtils;
...@@ -426,7 +427,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests { ...@@ -426,7 +427,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests {
MutablePropertySources propertySources = env.getPropertySources(); MutablePropertySources propertySources = env.getPropertySources();
propertySources.addFirst(new MapPropertySource("test", propertySources.addFirst(new MapPropertySource("test",
Collections.singletonMap("com.example.foo", 5))); Collections.singletonMap("com.example.foo", 5)));
propertySources.addLast(new SystemEnvironmentPropertySource("system", propertySources.addLast(new SystemEnvironmentPropertySource(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME,
Collections.singletonMap("COM_EXAMPLE_OTHER", "10"))); Collections.singletonMap("COM_EXAMPLE_OTHER", "10")));
this.context.register(TestConfiguration.class); this.context.register(TestConfiguration.class);
this.context.refresh(); this.context.refresh();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment