@@ -1679,23 +1679,16 @@ public void testCopyFile1ToDir() throws Exception {
16791679 }
16801680 final File destination = new File (directory , testFile1 .getName ());
16811681
1682- //Thread.sleep(LAST_MODIFIED_DELAY);
1683- //This is to slow things down so we can catch if
1684- //the lastModified date is not ok
1682+ backDateFile10Minutes (testFile1 );
16851683
16861684 FileUtils .copyFileToDirectory (testFile1 , directory );
16871685 assertTrue (destination .exists (), "Check Exist" );
16881686 assertEquals (testFile1Size , destination .length (), "Check Full copy" );
1689- /* disabled: Thread.sleep doesn't work reliantly for this case
1690- assertTrue("Check last modified date preserved",
1691- testFile1.lastModified() == destination.lastModified());*/
1687+ assertEquals (testFile1 .lastModified (), destination .lastModified (), "Check last modified date preserved" );
16921688
1693- try {
1694- FileUtils .copyFileToDirectory (destination , directory );
1695- fail ("Should not be able to copy a file into the same directory as itself" );
1696- } catch (final IOException ioe ) {
1697- //we want that, cannot copy to the same directory as the original file
1698- }
1689+ assertThrows (IOException .class ,
1690+ () -> FileUtils .copyFileToDirectory (destination , directory ),
1691+ "Should not be able to copy a file into the same directory as itself" );
16991692 }
17001693
17011694 @ Test
@@ -1706,16 +1699,12 @@ public void testCopyFile2ToDir() throws Exception {
17061699 }
17071700 final File destination = new File (directory , testFile1 .getName ());
17081701
1709- //Thread.sleep(LAST_MODIFIED_DELAY);
1710- //This is to slow things down so we can catch if
1711- //the lastModified date is not ok
1702+ backDateFile10Minutes (testFile1 );
17121703
17131704 FileUtils .copyFileToDirectory (testFile1 , directory );
17141705 assertTrue (destination .exists (), "Check Exist" );
17151706 assertEquals (testFile2Size , destination .length (), "Check Full copy" );
1716- /* disabled: Thread.sleep doesn't work reliantly for this case
1717- assertTrue("Check last modified date preserved",
1718- testFile1.lastModified() == destination.lastModified());*/
1707+ assertEquals (testFile1 .lastModified (), destination .lastModified (), "Check last modified date preserved" );
17191708 }
17201709
17211710 // forceDelete
0 commit comments