org.apache.commons.io
Class FileUtilsFileNewerTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.commons.io.testtools.FileBasedTestCase
              extended by org.apache.commons.io.FileUtilsFileNewerTestCase
All Implemented Interfaces:
junit.framework.Test

public class FileUtilsFileNewerTestCase
extends FileBasedTestCase

This is used to test FileUtils for correctness.

Author:
Alban Peignier

Constructor Summary
FileUtilsFileNewerTestCase(java.lang.String name)
           
 
Method Summary
protected  void setUp()
           
protected  void tearDown()
           
 void testIsFileNewer()
          Tests the isFileNewer(File, *) methods which a "normal" file.
protected  void testIsFileNewer(java.lang.String description, java.io.File file, long time, boolean wantedResult)
          Tests the isFileNewer(File, *) methods which the specified conditions.
 void testIsFileNewerImaginaryFile()
          Tests the isFileNewer(File, *) methods which a not existing file.
 void testIsFileNewerNoDate()
          Tests the isFileNewer(File, Date) method without specifying a Date.
 void testIsFileNewerNoFile()
          Tests the isFileNewer(File, long) method without specifying a File.
 void testIsFileNewerNoFileReference()
          Tests the isFileNewer(File, File) method without specifying a reference File.
 
Methods inherited from class org.apache.commons.io.testtools.FileBasedTestCase
assertEqualContent, assertEqualContent, checkFile, checkWrite, checkWrite, createFile, createLineBasedFile, deleteFile, generateTestData, generateTestData, getTestDirectory, newFile
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileUtilsFileNewerTestCase

public FileUtilsFileNewerTestCase(java.lang.String name)
Method Detail

setUp

protected void setUp()
              throws java.lang.Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
java.lang.Exception
See Also:
TestCase.setUp()

tearDown

protected void tearDown()
                 throws java.lang.Exception
Overrides:
tearDown in class junit.framework.TestCase
Throws:
java.lang.Exception
See Also:
TestCase.tearDown()

testIsFileNewer

public void testIsFileNewer()
Tests the isFileNewer(File, *) methods which a "normal" file.

See Also:
FileUtils#isFileNewer(File, long), FileUtils#isFileNewer(File, Date), FileUtils#isFileNewer(File, File)

testIsFileNewerImaginaryFile

public void testIsFileNewerImaginaryFile()
Tests the isFileNewer(File, *) methods which a not existing file.

See Also:
FileUtils#isFileNewer(File, long), FileUtils#isFileNewer(File, Date), FileUtils#isFileNewer(File, File)

testIsFileNewer

protected void testIsFileNewer(java.lang.String description,
                               java.io.File file,
                               long time,
                               boolean wantedResult)
Tests the isFileNewer(File, *) methods which the specified conditions.

Creates :

Then compares (with the needed isFileNewer method) the last modification date of the specified file with the specified time reference, the created Date and the temporary file.
The test is successfull if the three comparaisons return the specified wanted result.

Parameters:
description - describes the tested situation
file - the file of which the last modification date is compared
timeMillis - the time reference measured in milliseconds since the epoch
See Also:
FileUtils#isFileNewer(File, long), FileUtils#isFileNewer(File, Date), FileUtils#isFileNewer(File, File)

testIsFileNewerNoFile

public void testIsFileNewerNoFile()
Tests the isFileNewer(File, long) method without specifying a File.
The test is successfull if the method throws an IllegalArgumentException.


testIsFileNewerNoDate

public void testIsFileNewerNoDate()
Tests the isFileNewer(File, Date) method without specifying a Date.
The test is successfull if the method throws an IllegalArgumentException.


testIsFileNewerNoFileReference

public void testIsFileNewerNoFileReference()
Tests the isFileNewer(File, File) method without specifying a reference File.
The test is successfull if the method throws an IllegalArgumentException.



Copyright © 2002-2008 The Apache Software Foundation. All Rights Reserved.