From 9cf28950e53f24620eb2e8e103f4a98ad34c4c61 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 6 Oct 2015 13:25:27 +0200 Subject: [PATCH] PathResourceTests defensively compares last-modified timestamps at seconds precision Issue: SPR-13542 --- .../core/io/PathResourceTests.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/spring-core/src/test/java/org/springframework/core/io/PathResourceTests.java b/spring-core/src/test/java/org/springframework/core/io/PathResourceTests.java index ab2cbb0225..8b6361de33 100644 --- a/spring-core/src/test/java/org/springframework/core/io/PathResourceTests.java +++ b/spring-core/src/test/java/org/springframework/core/io/PathResourceTests.java @@ -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 { 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 -- GitLab