From 5883fc210f0df3ea24c40710fcf05e5da6ccae3b Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Mon, 17 Feb 2025 18:08:06 +0100 Subject: [PATCH] Revert "Fix ApplicationResourceLoaderTests on Windows" This reverts commit 09ac085a6a3824a8da5a6b2ca62b2e3f42f16705. --- .../boot/io/ApplicationResourceLoaderTests.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/io/ApplicationResourceLoaderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/io/ApplicationResourceLoaderTests.java index 4ffd034eaa..c7e863cf41 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/io/ApplicationResourceLoaderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/io/ApplicationResourceLoaderTests.java @@ -73,13 +73,12 @@ class ApplicationResourceLoaderTests { @Test void shouldLoadAbsolutePathWithWorkingDirectory() throws IOException { ClassLoader classLoader = getClass().getClassLoader(); - Path workingDirectory = Path.of("/working-directory"); Resource resource = ApplicationResourceLoader - .get(classLoader, SpringFactoriesLoader.forDefaultResourceLocation(classLoader), workingDirectory) - .getResource("/file.txt"); + .get(classLoader, SpringFactoriesLoader.forDefaultResourceLocation(classLoader), + Path.of("/working-directory")) + .getResource("/root/file.txt"); assertThat(resource.isFile()).isTrue(); - assertThat(resource.getFile()).hasName("file.txt") - .satisfies((file) -> assertThat(file.getParentFile()).isNotEqualTo(workingDirectory)); + assertThat(resource.getFile()).hasParent("/root").hasName("file.txt"); } @Test @@ -171,13 +170,12 @@ class ApplicationResourceLoaderTests { @Test void shouldLoadAbsoluteFileUrisWithWorkingDirectory() throws IOException { ClassLoader classLoader = getClass().getClassLoader(); - Path workingDirectory = Path.of("/working-directory"); Resource resource = ApplicationResourceLoader - .get(classLoader, SpringFactoriesLoader.forDefaultResourceLocation(classLoader), workingDirectory) + .get(classLoader, SpringFactoriesLoader.forDefaultResourceLocation(classLoader), + Path.of("/working-directory")) .getResource("file:/file.txt"); assertThat(resource.isFile()).isTrue(); - assertThat(resource.getFile()).hasName("file.txt") - .satisfies((file) -> assertThat(file.getParentFile()).isNotEqualTo(workingDirectory)); + assertThat(resource.getFile()).hasParent("/").hasName("file.txt"); } @Test