edu.rice.cs.drjava.model
Class GlobalModelIOTest

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.framework.TestCase
              |
              +--edu.rice.cs.drjava.model.GlobalModelTestCase
                    |
                    +--edu.rice.cs.drjava.model.GlobalModelIOTest
All Implemented Interfaces:
Test

public class GlobalModelIOTest
extends GlobalModelTestCase

Test I/O functions of the global model.

Version:
$Id: GlobalModelIOTest.java,v 1.16 2002/08/06 16:45:45 cmcgraw Exp $

Inner classes inherited from class edu.rice.cs.drjava.model.GlobalModelTestCase
GlobalModelTestCase.CancelingSelector, GlobalModelTestCase.CompileShouldFailListener, GlobalModelTestCase.CompileShouldSucceedListener, GlobalModelTestCase.FileSelector, GlobalModelTestCase.OpenWarningException, GlobalModelTestCase.OverwriteException, GlobalModelTestCase.TestListener, GlobalModelTestCase.WarningFileSelector
 
Fields inherited from class edu.rice.cs.drjava.model.GlobalModelTestCase
_model, _originalModel, _tempDir, BAR_TEXT, BAZ_TEXT, FOO_MISSING_CLOSE_TEXT, FOO_PACKAGE_AFTER_IMPORT, FOO_PACKAGE_AS_FIELD, FOO_PACKAGE_AS_FIELD_2, FOO_PACKAGE_AS_PART_OF_FIELD, FOO_PACKAGE_INSIDE_CLASS, FOO_TEXT
 
Fields inherited from class junit.framework.TestCase
fName
 
Constructor Summary
GlobalModelIOTest(String name)
          Constructor.
 
Method Summary
static Test suite()
          Creates a test suite for JUnit to run.
 void testCancelFirstSave()
          Attempts to make the first save of a document, but cancels instead.
 void testCancelOpenFile()
          Initiates a file open, but cancels.
 void testCancelOpenMultipleFiles()
          Initiates a file open, but cancels.
 void testCancelSaveAlreadySaved()
          First we save the document with FOO_TEXT.
 void testCancelSaveAsAlreadySaved()
          Make sure that saveAs doesn't save if we cancel!
 void testCloseFileAllowAbandon()
          Creates a new document, modifies it, then allows it to be closed, ignoring the changes made.
 void testCloseFileDisallowAbandon()
          Creates a new document, modifies it, but disallows a call to close it without saving changes.
 void testCloseMultipleFiles()
          Ensures closing documents works correctly.
 void testFileMovedWhenTriedToSave()
          Test for the possibility that the file has been moved or deleted since it was last referenced
 void testForceFileOpen()
          Force a file to be opened with getDocumentforFile
 void testModifiedByOther()
           
 void testModifiedByOtherFalse()
           
 void testMultipleFiles()
          Creates a new document, modifies it, and then does the same with a second document, ensuring that the changes are separate.
 void testMultipleFilesArray()
          Opens several documents and ensures that the array returned by the model is correct and in the right order.
 void testOpenMultipleFiles()
          Opens multiple files.
 void testOpenMultipleFilesError()
          Error checking for openening multiple files checks for null and an array w/null
 void testOpenMultipleNonexistentFiles()
          Attempts to open a non-existent file.
 void testOpenNonexistentFile()
          Attempts to open a non-existent file.
 void testOpenRealFile()
          Opens a file.
 void testRealSaveFirstSave()
          Makes a first save of the current document.
 void testReopenFile()
          Attempts to reopen an already open file.
 void testRevertFile()
          Force a file to be opened with getDocumentforFile
 void testSaveAllSaveInOrder()
          Make sure that all open files are saved in appropriate order, ie, even with BAR file as active document, save all should first prompt to save FOO, then BAR.
 void testSaveAlreadySaved()
          Saves a file already saved and overwrites its contents.
 void testSaveAsAlreadySaved()
          Make sure that saveAs saves to a different file.
 void testSaveAsExistsAndOpen()
           
 void testSaveAsExistsForOverwrite()
           
 void testSaveClearAndLoadHistory()
          Interprets some statements, saves the history, clears the history, then loads the history.
 
Methods inherited from class edu.rice.cs.drjava.model.GlobalModelTestCase
assertCompileErrorsPresent, assertCompileErrorsPresent, assertContents, assertLength, assertModified, assertNumOpenDocs, changeDocumentText, classForJava, createFile, createModel, interpret, interpretIgnoreResult, setUp, setupDocument, tearDown, tempDirectory, tempFile, tempFile, writeToNewTempFile
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, name, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Constructor Detail

GlobalModelIOTest

public GlobalModelIOTest(String name)
Constructor.
Parameters:
String - name
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

testMultipleFiles

public void testMultipleFiles()
                       throws BadLocationException
Creates a new document, modifies it, and then does the same with a second document, ensuring that the changes are separate.

testMultipleFilesArray

public void testMultipleFilesArray()
                            throws BadLocationException
Opens several documents and ensures that the array returned by the model is correct and in the right order.

testCloseMultipleFiles

public void testCloseMultipleFiles()
                            throws BadLocationException
Ensures closing documents works correctly.

testCloseFileAllowAbandon

public void testCloseFileAllowAbandon()
                               throws BadLocationException
Creates a new document, modifies it, then allows it to be closed, ignoring the changes made.

testCloseFileDisallowAbandon

public void testCloseFileDisallowAbandon()
                                  throws BadLocationException
Creates a new document, modifies it, but disallows a call to close it without saving changes.

testOpenRealFile

public void testOpenRealFile()
                      throws BadLocationException,
                             IOException
Opens a file.

testCancelOpenFile

public void testCancelOpenFile()
                        throws BadLocationException,
                               IOException
Initiates a file open, but cancels.

testOpenNonexistentFile

public void testOpenNonexistentFile()
                             throws BadLocationException,
                                    IOException
Attempts to open a non-existent file.

testReopenFile

public void testReopenFile()
                    throws BadLocationException,
                           IOException
Attempts to reopen an already open file.

testOpenMultipleFiles

public void testOpenMultipleFiles()
                           throws BadLocationException,
                                  IOException
Opens multiple files.

testCancelOpenMultipleFiles

public void testCancelOpenMultipleFiles()
                                 throws BadLocationException,
                                        IOException
Initiates a file open, but cancels.

testOpenMultipleNonexistentFiles

public void testOpenMultipleNonexistentFiles()
                                      throws BadLocationException,
                                             IOException
Attempts to open a non-existent file.

testOpenMultipleFilesError

public void testOpenMultipleFilesError()
                                throws BadLocationException,
                                       IOException
Error checking for openening multiple files checks for null and an array w/null

testForceFileOpen

public void testForceFileOpen()
                       throws BadLocationException,
                              IOException,
                              OperationCanceledException,
                              AlreadyOpenException
Force a file to be opened with getDocumentforFile

testCancelFirstSave

public void testCancelFirstSave()
                         throws BadLocationException,
                                IOException
Attempts to make the first save of a document, but cancels instead.

testRealSaveFirstSave

public void testRealSaveFirstSave()
                           throws BadLocationException,
                                  IOException
Makes a first save of the current document.

testSaveAlreadySaved

public void testSaveAlreadySaved()
                          throws BadLocationException,
                                 IOException
Saves a file already saved and overwrites its contents.

testCancelSaveAlreadySaved

public void testCancelSaveAlreadySaved()
                                throws BadLocationException,
                                       IOException
First we save the document with FOO_TEXT. Then we tell it to save over the old text, but pass in a CancelingSelector to cancel if we are asked for a new file name. This should not happen since the file is already saved.

testCancelSaveAsAlreadySaved

public void testCancelSaveAsAlreadySaved()
                                  throws BadLocationException,
                                         IOException
Make sure that saveAs doesn't save if we cancel!

testSaveAsAlreadySaved

public void testSaveAsAlreadySaved()
                            throws BadLocationException,
                                   IOException
Make sure that saveAs saves to a different file.

testSaveAsExistsForOverwrite

public void testSaveAsExistsForOverwrite()
                                  throws BadLocationException,
                                         IOException

testSaveAsExistsAndOpen

public void testSaveAsExistsAndOpen()
                             throws BadLocationException,
                                    IOException,
                                    OperationCanceledException,
                                    AlreadyOpenException

testSaveAllSaveInOrder

public void testSaveAllSaveInOrder()
                            throws BadLocationException,
                                   IOException
Make sure that all open files are saved in appropriate order, ie, even with BAR file as active document, save all should first prompt to save FOO, then BAR.

testRevertFile

public void testRevertFile()
                    throws BadLocationException,
                           IOException,
                           OperationCanceledException,
                           AlreadyOpenException
Force a file to be opened with getDocumentforFile

testModifiedByOther

public void testModifiedByOther()
                         throws BadLocationException,
                                IOException,
                                OperationCanceledException,
                                AlreadyOpenException,
                                InterruptedException

testModifiedByOtherFalse

public void testModifiedByOtherFalse()
                              throws BadLocationException,
                                     IOException,
                                     OperationCanceledException,
                                     AlreadyOpenException,
                                     InterruptedException

testSaveClearAndLoadHistory

public void testSaveClearAndLoadHistory()
                                 throws BadLocationException,
                                        InterruptedException,
                                        IOException
Interprets some statements, saves the history, clears the history, then loads the history.

testFileMovedWhenTriedToSave

public void testFileMovedWhenTriedToSave()
                                  throws BadLocationException,
                                         IOException
Test for the possibility that the file has been moved or deleted since it was last referenced