Skip to content

Commit a3daee6

Browse files
committed
Make File/Path tests pass on Windows
See gh-30806
1 parent 5614e5b commit a3daee6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

spring-core/src/test/java/org/springframework/util/ObjectUtilsTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -962,10 +962,10 @@ void nullSafeConciseToStringForUUID() {
962962

963963
@Test
964964
void nullSafeConciseToStringForFile() {
965-
String path = "/tmp/file.txt";
965+
String path = "/tmp/file.txt".replace('/', File.separatorChar);
966966
assertThat(ObjectUtils.nullSafeConciseToString(new File(path))).isEqualTo(path);
967967

968-
path = "/tmp/" + repeat("xyz", 32);
968+
path = ("/tmp/" + repeat("xyz", 32)).replace('/', File.separatorChar);
969969
assertThat(ObjectUtils.nullSafeConciseToString(new File(path)))
970970
.hasSize(truncatedLength)
971971
.startsWith(path.subSequence(0, 100))
@@ -974,10 +974,10 @@ void nullSafeConciseToStringForFile() {
974974

975975
@Test
976976
void nullSafeConciseToStringForPath() {
977-
String path = "/tmp/file.txt";
977+
String path = "/tmp/file.txt".replace('/', File.separatorChar);
978978
assertThat(ObjectUtils.nullSafeConciseToString(Paths.get(path))).isEqualTo(path);
979979

980-
path = "/tmp/" + repeat("xyz", 32);
980+
path = ("/tmp/" + repeat("xyz", 32)).replace('/', File.separatorChar);
981981
assertThat(ObjectUtils.nullSafeConciseToString(Paths.get(path)))
982982
.hasSize(truncatedLength)
983983
.startsWith(path.subSequence(0, 100))

0 commit comments

Comments
 (0)