From be90f7ddd496d16bdf09840b3010c3889d441cc6 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 (cherry picked from commit 9cf2895) --- .../core/io/PathResourceTests.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 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 4304d8b5c2..f584c3e62b 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 @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,17 +40,18 @@ import static org.mockito.BDDMockito.*; * @author Philippe Marschall * @author Phillip Webb * @author Nicholas Williams + * @author Juergen Hoeller */ public class PathResourceTests { - private static final String TEST_DIR = platformPath("src/test/java/org/" - + "springframework/core/io"); + private static final String TEST_DIR = + platformPath("src/test/java/org/springframework/core/io"); - private static final String TEST_FILE = platformPath("src/test/java/org/" - + "springframework/core/io/example.properties"); + private static final String TEST_FILE = + platformPath("src/test/java/org/springframework/core/io/example.properties"); - private static final String NON_EXISTING_FILE = platformPath("src/test/java/org/" - + "springframework/core/io/doesnotexist.properties"); + private static final String NON_EXISTING_FILE = + platformPath("src/test/java/org/springframework/core/io/doesnotexist.properties"); private static String platformPath(String string) { @@ -222,7 +223,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