Un-deprecate PathResource (for NIO Path resolution in createRelative)
Includes aligned createRelative signature and dedicated java.io.File test. Closes gh-24211
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package org.springframework.core.io;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -130,6 +131,14 @@ class ResourceTests {
|
||||
assertThat(resource).isEqualTo(new FileSystemResource(file));
|
||||
}
|
||||
|
||||
@Test
|
||||
void fileSystemResourceWithFile() throws IOException {
|
||||
File file = new File(getClass().getResource("Resource.class").getFile());
|
||||
Resource resource = new FileSystemResource(file);
|
||||
doTestResource(resource);
|
||||
assertThat(resource).isEqualTo(new FileSystemResource(file));
|
||||
}
|
||||
|
||||
@Test
|
||||
void fileSystemResourceWithFilePath() throws Exception {
|
||||
Path filePath = Paths.get(getClass().getResource("Resource.class").toURI());
|
||||
|
||||
Reference in New Issue
Block a user