Skip to content

Commit 25211d6

Browse files
committed
Looks like the 200ms weren't enough. Gump failed in one of the tests. Maybe this helps. sleeps are never good but I don't know how to do this in a better way.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/io/trunk@140544 13f79535-47bb-0310-9956-ffa450edef68
1 parent ade879d commit 25211d6

1 file changed

Lines changed: 19 additions & 11 deletions

File tree

src/test/org/apache/commons/io/FileUtilsTestCase.java

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
* @author Peter Donald
3333
* @author Matthew Hawthorne
34-
* @version $Id: FileUtilsTestCase.java,v 1.13 2004/03/12 22:22:25 jeremias Exp $
34+
* @version $Id: FileUtilsTestCase.java,v 1.14 2004/03/14 10:22:27 jeremias Exp $
3535
* @see FileUtils
3636
*/
3737
public class FileUtilsTestCase extends FileBasedTestCase {
@@ -42,6 +42,9 @@ public class FileUtilsTestCase extends FileBasedTestCase {
4242
* Size of test directory.
4343
*/
4444
private static final int TEST_DIRECTORY_SIZE = 0;
45+
46+
/** Delay in milliseconds to make sure test for "last modified date" are accurate */
47+
private static final int LAST_MODIFIED_DELAY = 600;
4548

4649
private File testFile1;
4750
private File testFile2;
@@ -250,8 +253,9 @@ private void log(Object obj) {
250253
public void testCopyFile1() throws Exception {
251254
File destination = new File(getTestDirectory(), "copy1.txt");
252255

253-
Thread.sleep(200); //This is to slow things down so we can catch if
254-
//the lastModified date is not ok
256+
Thread.sleep(LAST_MODIFIED_DELAY);
257+
//This is to slow things down so we can catch if
258+
//the lastModified date is not ok
255259

256260
FileUtils.copyFile(testFile1, destination);
257261
assertTrue("Check Exist", destination.exists());
@@ -263,8 +267,9 @@ public void testCopyFile1() throws Exception {
263267
public void testCopyFile2() throws Exception {
264268
File destination = new File(getTestDirectory(), "copy2.txt");
265269

266-
Thread.sleep(200); //This is to slow things down so we can catch if
267-
//the lastModified date is not ok
270+
Thread.sleep(LAST_MODIFIED_DELAY);
271+
//This is to slow things down so we can catch if
272+
//the lastModified date is not ok
268273

269274
FileUtils.copyFile(testFile1, destination);
270275
assertTrue("Check Exist", destination.exists());
@@ -276,8 +281,9 @@ public void testCopyFile2() throws Exception {
276281
public void testCopyFile2WithoutFileDatePreservation() throws Exception {
277282
File destination = new File(getTestDirectory(), "copy2.txt");
278283

279-
Thread.sleep(200); //This is to slow things down so we can catch if
280-
//the lastModified date is not ok
284+
Thread.sleep(LAST_MODIFIED_DELAY);
285+
//This is to slow things down so we can catch if
286+
//the lastModified date is not ok
281287

282288
FileUtils.copyFile(testFile1, destination, false);
283289
assertTrue("Check Exist", destination.exists());
@@ -312,8 +318,9 @@ public void testCopyFile1ToDir() throws Exception {
312318
directory.mkdirs();
313319
File destination = new File(directory, testFile1.getName());
314320

315-
Thread.sleep(200); //This is to slow things down so we can catch if
316-
//the lastModified date is not ok
321+
Thread.sleep(LAST_MODIFIED_DELAY);
322+
//This is to slow things down so we can catch if
323+
//the lastModified date is not ok
317324

318325
FileUtils.copyFileToDirectory(testFile1, directory);
319326
assertTrue("Check Exist", destination.exists());
@@ -328,8 +335,9 @@ public void testCopyFile2ToDir() throws Exception {
328335
directory.mkdirs();
329336
File destination = new File(directory, testFile1.getName());
330337

331-
Thread.sleep(200); //This is to slow things down so we can catch if
332-
//the lastModified date is not ok
338+
Thread.sleep(LAST_MODIFIED_DELAY);
339+
//This is to slow things down so we can catch if
340+
//the lastModified date is not ok
333341

334342
FileUtils.copyFileToDirectory(testFile1, directory);
335343
assertTrue("Check Exist", destination.exists());

0 commit comments

Comments
 (0)