Skip to content

Commit

Permalink
PathResourceTests defensively compares last-modified timestamps at se…
Browse files Browse the repository at this point in the history
…conds precision

Issue: SPR-13542
  • Loading branch information
jhoeller committed Oct 6, 2015
1 parent 181533c commit 9cf2895
Showing 1 changed file with 8 additions and 7 deletions.
Expand Up @@ -41,17 +41,18 @@
* @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) {
Expand Down Expand Up @@ -223,7 +224,7 @@ public void contentLengthForDirectory() throws Exception {
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
Expand Down

0 comments on commit 9cf2895

Please sign in to comment.