Allow test property sources to override command line args

Refine `SpringBootContextLoader` logic so that inline test properties
are always added above command line arguments.

Closes gh-29404
This commit is contained in:
Phillip Webb
2022-01-14 16:30:28 -08:00
parent 9278a502c7
commit c84d3c14fb
2 changed files with 1 additions and 22 deletions

View File

@@ -140,7 +140,7 @@ class SpringBootContextLoaderTests {
List<String> names = environment.getPropertySources().stream().map(PropertySource::getName)
.collect(Collectors.toList());
String last = names.remove(names.size() - 1);
assertThat(names).containsExactly("configurationProperties", "commandLineArgs", "Inlined Test Properties",
assertThat(names).containsExactly("configurationProperties", "Inlined Test Properties", "commandLineArgs",
"servletConfigInitParams", "servletContextInitParams", "systemProperties", "systemEnvironment",
"random");
assertThat(last).startsWith("Config resource");