From e083be7de1adf404a8300d232f47f20db57113c3 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Fri, 18 Dec 2020 15:25:45 +0000 Subject: [PATCH] Fix ConfigDataEnvironmentPostProcessorIntegrationTests in Windows --- ...taEnvironmentPostProcessorIntegrationTests.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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