Skip to content

Commit be90f7d

Browse files
committed
PathResourceTests defensively compares last-modified timestamps at seconds precision
Issue: SPR-13542 (cherry picked from commit 9cf2895)
1 parent 315a848 commit be90f7d

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

spring-core/src/test/java/org/springframework/core/io/PathResourceTests.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -40,17 +40,18 @@
4040
* @author Philippe Marschall
4141
* @author Phillip Webb
4242
* @author Nicholas Williams
43+
* @author Juergen Hoeller
4344
*/
4445
public class PathResourceTests {
4546

46-
private static final String TEST_DIR = platformPath("src/test/java/org/"
47-
+ "springframework/core/io");
47+
private static final String TEST_DIR =
48+
platformPath("src/test/java/org/springframework/core/io");
4849

49-
private static final String TEST_FILE = platformPath("src/test/java/org/"
50-
+ "springframework/core/io/example.properties");
50+
private static final String TEST_FILE =
51+
platformPath("src/test/java/org/springframework/core/io/example.properties");
5152

52-
private static final String NON_EXISTING_FILE = platformPath("src/test/java/org/"
53-
+ "springframework/core/io/doesnotexist.properties");
53+
private static final String NON_EXISTING_FILE =
54+
platformPath("src/test/java/org/springframework/core/io/doesnotexist.properties");
5455

5556

5657
private static String platformPath(String string) {
@@ -222,7 +223,7 @@ public void contentLengthForDirectory() throws Exception {
222223
public void lastModified() throws Exception {
223224
PathResource resource = new PathResource(TEST_FILE);
224225
File file = new File(TEST_FILE);
225-
assertThat(resource.lastModified(), equalTo(file.lastModified()));
226+
assertThat(resource.lastModified() / 1000, equalTo(file.lastModified() / 1000));
226227
}
227228

228229
@Test

0 commit comments

Comments
 (0)