From a3daee6ad8acde63c203c57a6c00d49d3b16efbf Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 4 Jul 2023 16:38:10 +0200 Subject: [PATCH] Make File/Path tests pass on Windows See gh-30806 --- .../java/org/springframework/util/ObjectUtilsTests.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-core/src/test/java/org/springframework/util/ObjectUtilsTests.java b/spring-core/src/test/java/org/springframework/util/ObjectUtilsTests.java index f3c8e8c353..30b444f99c 100644 --- a/spring-core/src/test/java/org/springframework/util/ObjectUtilsTests.java +++ b/spring-core/src/test/java/org/springframework/util/ObjectUtilsTests.java @@ -962,10 +962,10 @@ class ObjectUtilsTests { @Test void nullSafeConciseToStringForFile() { - String path = "/tmp/file.txt"; + String path = "/tmp/file.txt".replace('/', File.separatorChar); assertThat(ObjectUtils.nullSafeConciseToString(new File(path))).isEqualTo(path); - path = "/tmp/" + repeat("xyz", 32); + path = ("/tmp/" + repeat("xyz", 32)).replace('/', File.separatorChar); assertThat(ObjectUtils.nullSafeConciseToString(new File(path))) .hasSize(truncatedLength) .startsWith(path.subSequence(0, 100)) @@ -974,10 +974,10 @@ class ObjectUtilsTests { @Test void nullSafeConciseToStringForPath() { - String path = "/tmp/file.txt"; + String path = "/tmp/file.txt".replace('/', File.separatorChar); assertThat(ObjectUtils.nullSafeConciseToString(Paths.get(path))).isEqualTo(path); - path = "/tmp/" + repeat("xyz", 32); + path = ("/tmp/" + repeat("xyz", 32)).replace('/', File.separatorChar); assertThat(ObjectUtils.nullSafeConciseToString(Paths.get(path))) .hasSize(truncatedLength) .startsWith(path.subSequence(0, 100))