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 241dd75b0476..c7a46182b337 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 @@ -18,6 +18,7 @@ import java.io.File; import java.io.FileOutputStream; +import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; import java.util.Collections; @@ -56,6 +57,7 @@ import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; import org.springframework.core.io.ResourceLoader; +import org.springframework.util.FileCopyUtils; import org.springframework.util.StringUtils; import static org.assertj.core.api.Assertions.assertThat; @@ -544,6 +546,15 @@ void runWhenConfigLocationHasNonOptionalEmptyFileDirectoryDoesNotThrowException( .run("--spring.config.location=" + StringUtils.cleanPath(location.getAbsolutePath()) + "/")); } + @Test + void runWhenConfigLocationHasNonOptionalEmptyFileDoesNotThrowException() throws IOException { + File location = new File(this.temp, "application.properties"); + FileCopyUtils.copy(new byte[0], location); + assertThatNoException() + .isThrownBy(() -> this.application.run("--spring.config.location=classpath:/application.properties," + + StringUtils.cleanPath(location.getAbsolutePath()))); + } + @Test @Disabled("Disabled until spring.profiles suppport is dropped") void runWhenUsingInvalidPropertyThrowsException() {