edu.rice.cs.drjava.ui
Class RecentFileManagerTest

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.drjava.ui.RecentFileManagerTest
All Implemented Interfaces:
Test

public final class RecentFileManagerTest
extends DrJavaTestCase

Test functions of RecentFileManager.

Version:
$Id: RecentFileManagerTest.java 4422 2008-03-27 15:08:58Z rcartwright $

Field Summary
protected  File _tempDir
           
protected static String BAR_TEXT
           
protected static String FOO_TEXT
           
 
Fields inherited from class edu.rice.cs.drjava.DrJavaTestCase
TEST_DRJAVA_CONFIG_PROPERTY
 
Constructor Summary
RecentFileManagerTest()
           
 
Method Summary
 void setUp()
          Setup method for each JUnit test case.
static Test suite()
          Creates a test suite for JUnit to run.
 void tearDown()
          Clean up for every test case.
protected  File tempFile()
          Create a new temporary file in _tempDir.
 void testAddMoreThanMaxSize()
          Tests that the size of the recent files list doesn't get bigger than the maximum size.
 void testDirectoryFilterDescription()
          Verifies that the presentation names for the directory filter are correct.
 void testRemoveFile()
          Tests that files are removed correctly from the list.
 void testReopenFiles()
          Tests that the list is re-ordered correctly after a file is re-opened, even if it has a different path.
 void testShrinksToMaxSize()
          Tests that the size of the recent files list is reduced in response to a decrease in max size.
protected  File writeToNewTempFile(String text)
          Creates a new temporary file and writes the given text to it.
 
Methods inherited from class edu.rice.cs.drjava.DrJavaTestCase
setConfigSetting, setDocText
 
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

FOO_TEXT

protected static final String FOO_TEXT
See Also:
Constant Field Values

BAR_TEXT

protected static final String BAR_TEXT
See Also:
Constant Field Values

_tempDir

protected File _tempDir
Constructor Detail

RecentFileManagerTest

public RecentFileManagerTest()
Method Detail

suite

public static Test suite()
Creates a test suite for JUnit to run.

Returns:
a test suite based on the methods in this class

setUp

public void setUp()
           throws Exception
Setup method for each JUnit test case.

Overrides:
setUp in class DrJavaTestCase
Throws:
Exception - This convention is mandated by JUnit.TestCase, the superclass of this class.

tearDown

public void tearDown()
              throws Exception
Description copied from class: DrJavaTestCase
Clean up for every test case. Only used in unit tests. Added because Windows would intermittently throw a java.util.concurrent.RejectedExecutionException during cleanup.

Overrides:
tearDown in class DrJavaTestCase
Throws:
Exception

tempFile

protected File tempFile()
                 throws IOException
Create a new temporary file in _tempDir. Calls with the same int will return the same filename, while calls with different ints will return different filenames.

Throws:
IOException

writeToNewTempFile

protected File writeToNewTempFile(String text)
                           throws IOException
Creates a new temporary file and writes the given text to it. The File object for the new file is returned.

Throws:
IOException

testAddMoreThanMaxSize

public void testAddMoreThanMaxSize()
                            throws IOException
Tests that the size of the recent files list doesn't get bigger than the maximum size.

Throws:
IOException

testShrinksToMaxSize

public void testShrinksToMaxSize()
                          throws IOException
Tests that the size of the recent files list is reduced in response to a decrease in max size.

Throws:
IOException

testRemoveFile

public void testRemoveFile()
                    throws Exception
Tests that files are removed correctly from the list.

Throws:
Exception

testReopenFiles

public void testReopenFiles()
                     throws Exception
Tests that the list is re-ordered correctly after a file is re-opened, even if it has a different path.

Throws:
Exception

testDirectoryFilterDescription

public void testDirectoryFilterDescription()
Verifies that the presentation names for the directory filter are correct.