Preserve property ordering for text blocks in @TestPropertySource

See gh-31053
This commit is contained in:
Sam Brannen
2023-08-16 13:48:25 +02:00
parent 17109b2402
commit b43972bb54
2 changed files with 33 additions and 23 deletions

View File

@@ -78,16 +78,12 @@ class InlinedPropertiesWithTextBlockTestPropertySourceTests {
assertEnvironmentProperty(this.env, "key.value.3", "key:value");
}
/**
* Not necessarily preserved because the properties are all added at the
* same time.
*/
@Test
@SuppressWarnings("rawtypes")
void propertyNameOrderingIsNotNecessarilyPreservedInEnvironment() {
void propertyNameOrderingIsPreservedInEnvironment() {
EnumerablePropertySource eps = (EnumerablePropertySource) env.getPropertySources().get(
INLINED_PROPERTIES_PROPERTY_SOURCE_NAME);
assertThat(eps.getPropertyNames()).containsExactlyInAnyOrder("foo", "baz", "enigma", "x.y.z",
assertThat(eps.getPropertyNames()).containsExactly("foo", "baz", "enigma", "x.y.z",
"server.url", "key.value.1", "key.value.2", "key.value.3");
}