Browse Source

PathResourceTests defensively compares last-modified timestamps at seconds precision

Issue: SPR-13542
pull/881/head
Juergen Hoeller 9 years ago
parent
commit
9cf28950e5
  1. 15
      spring-core/src/test/java/org/springframework/core/io/PathResourceTests.java

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

@ -41,17 +41,18 @@ import static org.mockito.BDDMockito.*; @@ -41,17 +41,18 @@ import static org.mockito.BDDMockito.*;
* @author Phillip Webb
* @author Nicholas Williams
* @author Stephane Nicoll
* @author Juergen Hoeller
*/
public class PathResourceTests {
private static final String TEST_DIR = platformPath("src/test/resources/org/"
+ "springframework/core/io");
private static final String TEST_DIR =
platformPath("src/test/resources/org/springframework/core/io");
private static final String TEST_FILE = platformPath("src/test/resources/org/"
+ "springframework/core/io/example.properties");
private static final String TEST_FILE =
platformPath("src/test/resources/org/springframework/core/io/example.properties");
private static final String NON_EXISTING_FILE = platformPath("src/test/resources/org/"
+ "springframework/core/io/doesnotexist.properties");
private static final String NON_EXISTING_FILE =
platformPath("src/test/resources/org/springframework/core/io/doesnotexist.properties");
private static String platformPath(String string) {
@ -223,7 +224,7 @@ public class PathResourceTests { @@ -223,7 +224,7 @@ public class PathResourceTests {
public void lastModified() throws Exception {
PathResource resource = new PathResource(TEST_FILE);
File file = new File(TEST_FILE);
assertThat(resource.lastModified(), equalTo(file.lastModified()));
assertThat(resource.lastModified() / 1000, equalTo(file.lastModified() / 1000));
}
@Test

Loading…
Cancel
Save