|
|
|
@ -262,9 +262,13 @@ class GenericApplicationContextTests { |
|
|
|
resource = context.getResource(fileLocation); |
|
|
|
resource = context.getResource(fileLocation); |
|
|
|
assertThat(resource).isInstanceOf(FileUrlResource.class); |
|
|
|
assertThat(resource).isInstanceOf(FileUrlResource.class); |
|
|
|
|
|
|
|
|
|
|
|
if (OS.WINDOWS.isCurrentOs()) { |
|
|
|
// If we are using a FileSystemResourceLoader on Windows, we expect an error
|
|
|
|
// On Windows we expect an error similar to the following.
|
|
|
|
// similar to the following since "ping:foo" is not a valid file name in the
|
|
|
|
// java.nio.file.InvalidPathException: Illegal char <:> at index 4: ping:foo
|
|
|
|
// Windows file system and since the PingPongProtocolResolver has not yet been
|
|
|
|
|
|
|
|
// registered.
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// java.nio.file.InvalidPathException: Illegal char <:> at index 4: ping:foo
|
|
|
|
|
|
|
|
if (resourceLoader instanceof FileSystemResourceLoader && OS.WINDOWS.isCurrentOs()) { |
|
|
|
assertThatExceptionOfType(InvalidPathException.class) |
|
|
|
assertThatExceptionOfType(InvalidPathException.class) |
|
|
|
.isThrownBy(() -> context.getResource(pingLocation)) |
|
|
|
.isThrownBy(() -> context.getResource(pingLocation)) |
|
|
|
.withMessageContaining(pingLocation); |
|
|
|
.withMessageContaining(pingLocation); |
|
|
|
|