Polish "Improve performance of CompositePropertySource#getPropertyNames"
See gh-27236
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package org.springframework.core.env;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -46,4 +47,13 @@ class CompositePropertySourceTests {
|
||||
assertThat(((i1 < i2) && (i2 < i3))).as("Bad order: " + s).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void getPropertyNamesRemovesDuplicates() {
|
||||
CompositePropertySource composite = new CompositePropertySource("c");
|
||||
composite.addPropertySource(new MapPropertySource("p1", Map.of("p1.property", "value")));
|
||||
composite.addPropertySource(new MapPropertySource("p2",
|
||||
Map.of("p2.property1", "value", "p1.property", "value", "p2.property2", "value")));
|
||||
assertThat(composite.getPropertyNames()).containsOnly("p1.property", "p2.property1", "p2.property2");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user