edu.rice.cs.drjava.ui
Class SingleDisplayModelTest

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

public class SingleDisplayModelTest
extends GlobalModelTestCase

Test functions of the single display model.

Version:
$Id: SingleDisplayModelTest.java,v 1.8 2002/09/02 21:24:13 csreis Exp $

Inner Class Summary
static class SingleDisplayModelTest.SDTestListener
          A SingleDisplayModelListener for testing.
 
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
SingleDisplayModelTest(String name)
          Constructor.
 
Method Summary
protected  void assertActiveDocument(OpenDefinitionsDocument doc)
           
protected  void assertNotEmpty()
           
protected  void createModel()
          Instantiates the SingleDisplayModel to be used in the test cases.
protected  SingleDisplayModel getSDModel()
          Get the instance of the SingleDisplayModel.
 void setUp()
          Custom setup for SingleDisplayModel tests.
protected  OpenDefinitionsDocument setupDocument(String text)
          Creates and returns a new document, makes sure newFile and activeDocumentChanged events are fired, and then adds some text.
static Test suite()
          Creates a test suite for JUnit to run.
 void testCloseFiles()
          Tests that active document is switched on close, and that a new file is created after the last one is closed.
 void testCloseUnmodifiedAutomatically()
          Ensures that an unmodified, empty document is closed after a file is opened, while a modified document is left open.
 void testDisplayFilename()
          Tests that active document is switched on close, and that a new file is created after the last one is closed.
 void testDocumentSwitching()
          Tests the setNext and setPrevious functions, making sure that the activeDocumentChanged event is called.
 void testNotEmptyOnStartup()
          Tests the invariant that at least one document is open at time of creation.
 
Methods inherited from class edu.rice.cs.drjava.model.GlobalModelTestCase
assertCompileErrorsPresent, assertCompileErrorsPresent, assertContents, assertLength, assertModified, assertNumOpenDocs, changeDocumentText, classForJava, createFile, interpret, interpretIgnoreResult, 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

SingleDisplayModelTest

public SingleDisplayModelTest(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

createModel

protected void createModel()
Instantiates the SingleDisplayModel to be used in the test cases.
Overrides:
createModel in class GlobalModelTestCase

getSDModel

protected SingleDisplayModel getSDModel()
Get the instance of the SingleDisplayModel.

assertNotEmpty

protected void assertNotEmpty()
                       throws BadLocationException

assertActiveDocument

protected void assertActiveDocument(OpenDefinitionsDocument doc)
                             throws BadLocationException

setupDocument

protected OpenDefinitionsDocument setupDocument(String text)
                                         throws BadLocationException
Creates and returns a new document, makes sure newFile and activeDocumentChanged events are fired, and then adds some text.
Overrides:
setupDocument in class GlobalModelTestCase
Returns:
the new modified document

setUp

public void setUp()
           throws IOException
Custom setup for SingleDisplayModel tests.
Overrides:
setUp in class GlobalModelTestCase

testNotEmptyOnStartup

public void testNotEmptyOnStartup()
                           throws BadLocationException
Tests the invariant that at least one document is open at time of creation.

testDocumentSwitching

public void testDocumentSwitching()
                           throws BadLocationException
Tests the setNext and setPrevious functions, making sure that the activeDocumentChanged event is called.

testCloseUnmodifiedAutomatically

public void testCloseUnmodifiedAutomatically()
                                      throws BadLocationException,
                                             IOException,
                                             OperationCanceledException,
                                             AlreadyOpenException
Ensures that an unmodified, empty document is closed after a file is opened, while a modified document is left open.

testCloseFiles

public void testCloseFiles()
                    throws BadLocationException
Tests that active document is switched on close, and that a new file is created after the last one is closed.

testDisplayFilename

public void testDisplayFilename()
                         throws BadLocationException,
                                IOException,
                                OperationCanceledException,
                                AlreadyOpenException
Tests that active document is switched on close, and that a new file is created after the last one is closed.