edu.rice.cs.util
Class FileOpsTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by edu.rice.cs.drjava.DrJavaTestCase
              extended by edu.rice.cs.util.FileOpsTest
All Implemented Interfaces:
Test

public class FileOpsTest
extends DrJavaTestCase

Test cases for FileOps.

Version:
$Id: FileOpsTest.java 5175 2010-01-20 08:46:32Z mgricken $

Nested Class Summary
 
Nested classes/interfaces inherited from class junit.framework.TestCase
TestCase.WrappedException
 
Field Summary
private static Log _log
           
static java.lang.String PREFIX
           
static java.lang.String SUFFIX
           
static java.lang.String TEXT
           
 
Constructor Summary
FileOpsTest()
           
 
Method Summary
private  java.lang.String fixPathFormat(java.lang.String s)
           
static void main(java.lang.String[] args)
          Main method called by testDeleteDirectoryOnExit.
 void testConvertToAbsolutePathEntries()
           
 void testCreateTempDirectory()
           
 void testDeleteDirectoryOnExit()
          Tests that non-empty directories can be deleted on exit.
 void testGetFiles()
          Tests getFilesInDir.
 void testGetShortFile()
          Tests for getShortFile.
 void testMakeRelativeTo()
           
 void testPackageExplore()
          This tests that packageExplore correctly runs through and returns non-empty packages
 void testReadAndWriteTempFile()
           
 void testRecursiveDirectoryDelete()
           
 void testSaveFile()
          This method checks that backups are made correctly, that when a save fails, no data is lost, and that when a save is attempted on a write-protected file, the save fails (bug #782963).
 void testSplitFile()
           
 
Methods inherited from class edu.rice.cs.drjava.DrJavaTestCase
setConfigSetting, setDocText, setUp, tearDown
 
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, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_log

private static final Log _log

TEXT

public static final java.lang.String TEXT
See Also:
Constant Field Values

PREFIX

public static final java.lang.String PREFIX
See Also:
Constant Field Values

SUFFIX

public static final java.lang.String SUFFIX
See Also:
Constant Field Values
Constructor Detail

FileOpsTest

public FileOpsTest()
Method Detail

testCreateTempDirectory

public void testCreateTempDirectory()
                             throws java.io.IOException
Throws:
java.io.IOException

testReadAndWriteTempFile

public void testReadAndWriteTempFile()
                              throws java.io.IOException
Throws:
java.io.IOException

testRecursiveDirectoryDelete

public void testRecursiveDirectoryDelete()
                                  throws java.io.IOException
Throws:
java.io.IOException

testSaveFile

public void testSaveFile()
                  throws java.io.IOException
This method checks that backups are made correctly, that when a save fails, no data is lost, and that when a save is attempted on a write-protected file, the save fails (bug #782963).

Throws:
java.io.IOException

testPackageExplore

public void testPackageExplore()
                        throws java.io.IOException
This tests that packageExplore correctly runs through and returns non-empty packages

Throws:
java.io.IOException

testDeleteDirectoryOnExit

public void testDeleteDirectoryOnExit()
                               throws java.io.IOException,
                                      java.lang.InterruptedException
Tests that non-empty directories can be deleted on exit.

Throws:
java.io.IOException
java.lang.InterruptedException

testSplitFile

public void testSplitFile()

fixPathFormat

private java.lang.String fixPathFormat(java.lang.String s)

testMakeRelativeTo

public void testMakeRelativeTo()
                        throws java.io.IOException,
                               java.lang.SecurityException
Throws:
java.io.IOException
java.lang.SecurityException

main

public static void main(java.lang.String[] args)
Main method called by testDeleteDirectoryOnExit. Runs in new JVM so the files can be deleted. Exits with status 1 if wrong number of arguments are passed. Exits with status 2 if file doesn't exist.

Parameters:
args - should contain the file name of the directory to delete on exit

testConvertToAbsolutePathEntries

public void testConvertToAbsolutePathEntries()

testGetFiles

public void testGetFiles()
                  throws java.io.IOException
Tests getFilesInDir.

Throws:
java.io.IOException

testGetShortFile

public void testGetShortFile()
                      throws java.io.IOException
Tests for getShortFile. This test creates a file and writes to it using a long file name, then checks if the short file name is the same (canonical) file and that it contains teh same data.

Throws:
java.io.IOException