diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorIntegrationTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorIntegrationTests.java index c7a46182b337..966e90ee7e58 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorIntegrationTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorIntegrationTests.java @@ -21,6 +21,7 @@ import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -29,6 +30,7 @@ import java.util.stream.Collectors; import java.util.stream.StreamSupport; +import org.apache.logging.log4j.util.Strings; import org.assertj.core.api.Condition; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -413,18 +415,18 @@ void loadWhenHasWhitespaceTrims() { void loadWhenHasConfigLocationAsFile() { String location = "file:src/test/resources/specificlocation.properties"; ConfigurableApplicationContext context = this.application.run("--spring.config.location=" + location); - assertThat(context.getEnvironment()).has(matchingPropertySource( - "Config resource 'file [src/test/resources/specificlocation.properties]' via location '" + location - + "'")); + assertThat(context.getEnvironment()).has(matchingPropertySource("Config resource 'file [" + Strings + .join(Arrays.asList("src", "test", "resources", "specificlocation.properties"), File.separatorChar) + + "]' via location '" + location + "'")); } @Test void loadWhenHasRelativeConfigLocationUsesFileLocation() { String location = "src/test/resources/specificlocation.properties"; ConfigurableApplicationContext context = this.application.run("--spring.config.location=" + location); - assertThat(context.getEnvironment()).has(matchingPropertySource( - "Config resource 'file [src/test/resources/specificlocation.properties]' via location '" + location - + "'")); + assertThat(context.getEnvironment()).has(matchingPropertySource("Config resource 'file [" + Strings + .join(Arrays.asList("src", "test", "resources", "specificlocation.properties"), File.separatorChar) + + "]' via location '" + location + "'")); } @Test