PathResourceTests defensively compares last-modified timestamps at seconds precision
Issue: SPR-13542
This commit is contained in:
@@ -41,17 +41,18 @@ import static org.mockito.BDDMockito.*;
|
|||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @author Nicholas Williams
|
* @author Nicholas Williams
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
|
* @author Juergen Hoeller
|
||||||
*/
|
*/
|
||||||
public class PathResourceTests {
|
public class PathResourceTests {
|
||||||
|
|
||||||
private static final String TEST_DIR = platformPath("src/test/resources/org/"
|
private static final String TEST_DIR =
|
||||||
+ "springframework/core/io");
|
platformPath("src/test/resources/org/springframework/core/io");
|
||||||
|
|
||||||
private static final String TEST_FILE = platformPath("src/test/resources/org/"
|
private static final String TEST_FILE =
|
||||||
+ "springframework/core/io/example.properties");
|
platformPath("src/test/resources/org/springframework/core/io/example.properties");
|
||||||
|
|
||||||
private static final String NON_EXISTING_FILE = platformPath("src/test/resources/org/"
|
private static final String NON_EXISTING_FILE =
|
||||||
+ "springframework/core/io/doesnotexist.properties");
|
platformPath("src/test/resources/org/springframework/core/io/doesnotexist.properties");
|
||||||
|
|
||||||
|
|
||||||
private static String platformPath(String string) {
|
private static String platformPath(String string) {
|
||||||
@@ -223,7 +224,7 @@ public class PathResourceTests {
|
|||||||
public void lastModified() throws Exception {
|
public void lastModified() throws Exception {
|
||||||
PathResource resource = new PathResource(TEST_FILE);
|
PathResource resource = new PathResource(TEST_FILE);
|
||||||
File file = new File(TEST_FILE);
|
File file = new File(TEST_FILE);
|
||||||
assertThat(resource.lastModified(), equalTo(file.lastModified()));
|
assertThat(resource.lastModified() / 1000, equalTo(file.lastModified() / 1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user