Fix tests on Windows

See gh-37808
This commit is contained in:
Andy Wilkinson
2023-10-18 14:08:41 +01:00
parent 1559485f56
commit 851e6def76
2 changed files with 4 additions and 6 deletions

View File

@@ -16,8 +16,6 @@
package org.springframework.boot.autoconfigure.ssl;
import java.io.FileNotFoundException;
import java.io.UncheckedIOException;
import java.net.URL;
import java.nio.file.Path;
import java.util.LinkedHashSet;
@@ -106,10 +104,10 @@ class SslPropertiesBundleRegistrar implements SslBundleRegistrar {
URL url = ResourceUtils.getURL(value);
Assert.state("file".equalsIgnoreCase(url.getProtocol()),
() -> "SSL bundle '%s' '%s' URL '%s' doesn't point to a file".formatted(bundleName, field, url));
return Path.of(url.getFile()).toAbsolutePath();
return Path.of(url.toURI()).toAbsolutePath();
}
catch (FileNotFoundException ex) {
throw new UncheckedIOException(
catch (Exception ex) {
throw new RuntimeException(
"SSL bundle '%s' '%s' location '%s' cannot be watched".formatted(bundleName, field, value), ex);
}
}

View File

@@ -111,7 +111,7 @@ class FileWatcherTests {
Path directory = tempDir.resolve("dir1");
assertThatExceptionOfType(UncheckedIOException.class)
.isThrownBy(() -> this.fileWatcher.watch(Set.of(directory), new WaitingCallback()))
.withMessageMatching("Failed to register paths for watching: \\[.+/dir1]");
.withMessage("Failed to register paths for watching: [%s]".formatted(directory));
}
@Test