@@ -73,12 +73,13 @@ void shouldLoadAbsolutePath() throws IOException {
73
73
@ Test
74
74
void shouldLoadAbsolutePathWithWorkingDirectory () throws IOException {
75
75
ClassLoader classLoader = getClass ().getClassLoader ();
76
+ Path workingDirectory = Path .of ("/working-directory" );
76
77
Resource resource = ApplicationResourceLoader
77
- .get (classLoader , SpringFactoriesLoader .forDefaultResourceLocation (classLoader ),
78
- Path .of ("/working-directory" ))
79
- .getResource ("/root/file.txt" );
78
+ .get (classLoader , SpringFactoriesLoader .forDefaultResourceLocation (classLoader ), workingDirectory )
79
+ .getResource ("/file.txt" );
80
80
assertThat (resource .isFile ()).isTrue ();
81
- assertThat (resource .getFile ()).hasParent ("/root" ).hasName ("file.txt" );
81
+ assertThat (resource .getFile ()).hasName ("file.txt" )
82
+ .satisfies ((file ) -> assertThat (file .getParentFile ()).isNotEqualTo (workingDirectory ));
82
83
}
83
84
84
85
@ Test
@@ -170,12 +171,13 @@ void shouldLoadRelativeFileUrisWithWorkingDirectory() throws IOException {
170
171
@ Test
171
172
void shouldLoadAbsoluteFileUrisWithWorkingDirectory () throws IOException {
172
173
ClassLoader classLoader = getClass ().getClassLoader ();
174
+ Path workingDirectory = Path .of ("/working-directory" );
173
175
Resource resource = ApplicationResourceLoader
174
- .get (classLoader , SpringFactoriesLoader .forDefaultResourceLocation (classLoader ),
175
- Path .of ("/working-directory" ))
176
+ .get (classLoader , SpringFactoriesLoader .forDefaultResourceLocation (classLoader ), workingDirectory )
176
177
.getResource ("file:/file.txt" );
177
178
assertThat (resource .isFile ()).isTrue ();
178
- assertThat (resource .getFile ()).hasParent ("/" ).hasName ("file.txt" );
179
+ assertThat (resource .getFile ()).hasName ("file.txt" )
180
+ .satisfies ((file ) -> assertThat (file .getParentFile ()).isNotEqualTo (workingDirectory ));
179
181
}
180
182
181
183
@ Test
0 commit comments