edu.rice.cs.drjava.model
Class GlobalModelCompileTest

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

public class GlobalModelCompileTest
extends GlobalModelTestCase

A test on the GlobalModel for compilation.

Version:
$Id: GlobalModelCompileTest.java,v 1.21 2002/09/02 21:24:11 csreis 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
 
Field Summary
private static String BAR_MISSING_SEMI_TEXT
           
private static String FOO_MISSING_CLOSE_TEXT
           
private static String FOO_NON_PUBLIC_CLASS_TEXT
           
private static String FOO_PACKAGE_AFTER_IMPORT
           
private static String FOO_PACKAGE_AS_FIELD
           
private static String FOO_PACKAGE_AS_FIELD_2
           
private static String FOO_PACKAGE_AS_PART_OF_FIELD
           
private static String FOO_PACKAGE_INSIDE_CLASS
           
private static String FOO_WITH_ASSERT
           
private static String FOO2_EXTENDS_FOO_TEXT
           
private static String FOO2_REFERENCES_NON_PUBLIC_CLASS_TEXT
           
 
Fields inherited from class edu.rice.cs.drjava.model.GlobalModelTestCase
_model, _originalModel, _tempDir, BAR_TEXT, BAZ_TEXT, FOO_TEXT
 
Fields inherited from class junit.framework.TestCase
fName
 
Constructor Summary
GlobalModelCompileTest(String name)
          Constructor.
 
Method Summary
private  String _name()
           
 void runBare()
          Overrides TestCase.runBare() to interatively run this test case for each compiler.
static Test suite()
          Creates a test suite for JUnit to run.
 void testClassFileSynchronization()
          After creating a new file, saving, and compiling it, this test checks that the new document is in sync after compiling and is out of sync after modifying and even saving it.
 void testClassFileSynchronizationAfterRename()
          Ensure that renaming a file makes it out of sync with its class file.
 void testCompileAbortsIfAnyUnsaved()
          If we try to compile while any files are unsaved, and if we don't save when asked to saveAllBeforeProceeding, it should not do the compile or any other actions.
 void testCompileAbortsIfUnsaved()
          If we try to compile an unsaved file, and if we don't save when asked to saveAllBeforeProceeding, it should not do the compile or any other actions.
 void testCompileActiveSavedAnyUnsavedButSaveWhenAsked()
          If we try to compile while any files (but not the active file) are unsaved but we do save it from within saveAllBeforeProceeding, the compile should occur happily.
 void testCompileAfterFileMoved()
          Tests a compile after a file has unexpectedly been moved or deleted.
 void testCompileAllDifferentSourceRoots()
          Tests calling compileAll with different source roots works.
 void testCompileAllFailsDifferentSourceRoots()
          Tests calling compileAll with different source roots works if the files have errors in them.
 void testCompileAnyUnsavedButSaveWhenAsked()
          If we try to compile while any files (including the active file) are unsaved but we do save it from within saveAllBeforeProceeding, the compile should occur happily.
 void testCompileClasspathOKDefaultPackage()
          Test that one compiled file can depend on the other and that when a keyword is part of a field name, the file will compile.
 void testCompileClasspathOKDifferentPackages()
          Test that one compiled file can depend on the other.
 void testCompileMissingCloseSquiggly()
          Tests compiling an invalid file and checks to make sure the class file was not created.
 void testCompilePackageAsField()
          Creates a source file with "package" as a field name and ensures that compile starts but fails due to the invalid field name.
 void testCompilePackageAsField2()
          Creates a source file with "package" as a field name and ensures that compile starts but fails due to the invalid field name.
 void testCompileReferenceToNonPublicClass()
          Tests a compile on a file that references a non-public class defined in another class with a name different than the non-public class
 void testCompileWithJavaAssert()
          Test support for assert keyword if enabled.
 void testCompileWithPackageStatementInsideClass()
          Puts an otherwise valid package statement inside a class declaration.
 
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, 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
 

Field Detail

FOO_MISSING_CLOSE_TEXT

private static final String FOO_MISSING_CLOSE_TEXT

BAR_MISSING_SEMI_TEXT

private static final String BAR_MISSING_SEMI_TEXT

FOO_PACKAGE_AFTER_IMPORT

private static final String FOO_PACKAGE_AFTER_IMPORT

FOO_PACKAGE_INSIDE_CLASS

private static final String FOO_PACKAGE_INSIDE_CLASS

FOO_PACKAGE_AS_FIELD

private static final String FOO_PACKAGE_AS_FIELD

FOO_PACKAGE_AS_FIELD_2

private static final String FOO_PACKAGE_AS_FIELD_2

FOO_PACKAGE_AS_PART_OF_FIELD

private static final String FOO_PACKAGE_AS_PART_OF_FIELD

FOO2_EXTENDS_FOO_TEXT

private static final String FOO2_EXTENDS_FOO_TEXT

FOO_NON_PUBLIC_CLASS_TEXT

private static final String FOO_NON_PUBLIC_CLASS_TEXT

FOO2_REFERENCES_NON_PUBLIC_CLASS_TEXT

private static final String FOO2_REFERENCES_NON_PUBLIC_CLASS_TEXT

FOO_WITH_ASSERT

private static final String FOO_WITH_ASSERT
Constructor Detail

GlobalModelCompileTest

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

runBare

public void runBare()
             throws Throwable
Overrides TestCase.runBare() to interatively run this test case for each compiler. This method is called once per test method, and it magically invokes the method.
Overrides:
runBare in class TestCase

_name

private String _name()

testCompileAllDifferentSourceRoots

public void testCompileAllDifferentSourceRoots()
                                        throws BadLocationException,
                                               IOException,
                                               InterruptedException
Tests calling compileAll with different source roots works.

testCompileAllFailsDifferentSourceRoots

public void testCompileAllFailsDifferentSourceRoots()
                                             throws BadLocationException,
                                                    IOException
Tests calling compileAll with different source roots works if the files have errors in them. (Each file has 1 error.)

testCompileClasspathOKDefaultPackage

public void testCompileClasspathOKDefaultPackage()
                                          throws BadLocationException,
                                                 IOException,
                                                 InterruptedException
Test that one compiled file can depend on the other and that when a keyword is part of a field name, the file will compile. We compile DrJavaTestFoo and then DrJavaTestFoo2 (which extends DrJavaTestFoo). This shows that the compiler successfully found DrJavaTestFoo2 when compiling DrJavaTestFoo.

testCompileClasspathOKDifferentPackages

public void testCompileClasspathOKDifferentPackages()
                                             throws BadLocationException,
                                                    IOException,
                                                    InterruptedException
Test that one compiled file can depend on the other. We compile a.DrJavaTestFoo and then b.DrJavaTestFoo2 (which extends DrJavaTestFoo). This shows that the compiler successfully found DrJavaTestFoo2 when compiling DrJavaTestFoo.

testCompilePackageAsField

public void testCompilePackageAsField()
                               throws BadLocationException,
                                      IOException
Creates a source file with "package" as a field name and ensures that compile starts but fails due to the invalid field name.

testCompilePackageAsField2

public void testCompilePackageAsField2()
                                throws BadLocationException,
                                       IOException
Creates a source file with "package" as a field name and ensures that compile starts but fails due to the invalid field name. This is different from testCompilePackageAsField() as it initializes the field.

testCompileMissingCloseSquiggly

public void testCompileMissingCloseSquiggly()
                                     throws BadLocationException,
                                            IOException
Tests compiling an invalid file and checks to make sure the class file was not created.

testCompileWithPackageStatementInsideClass

public void testCompileWithPackageStatementInsideClass()
                                                throws BadLocationException,
                                                       IOException
Puts an otherwise valid package statement inside a class declaration. This better not work!

testCompileAbortsIfUnsaved

public void testCompileAbortsIfUnsaved()
                                throws BadLocationException,
                                       IOException
If we try to compile an unsaved file, and if we don't save when asked to saveAllBeforeProceeding, it should not do the compile or any other actions.

testCompileAbortsIfAnyUnsaved

public void testCompileAbortsIfAnyUnsaved()
                                   throws BadLocationException,
                                          IOException
If we try to compile while any files are unsaved, and if we don't save when asked to saveAllBeforeProceeding, it should not do the compile or any other actions.

testCompileAnyUnsavedButSaveWhenAsked

public void testCompileAnyUnsavedButSaveWhenAsked()
                                           throws BadLocationException,
                                                  IOException,
                                                  InterruptedException
If we try to compile while any files (including the active file) are unsaved but we do save it from within saveAllBeforeProceeding, the compile should occur happily.

testCompileActiveSavedAnyUnsavedButSaveWhenAsked

public void testCompileActiveSavedAnyUnsavedButSaveWhenAsked()
                                                      throws BadLocationException,
                                                             IOException,
                                                             InterruptedException
If we try to compile while any files (but not the active file) are unsaved but we do save it from within saveAllBeforeProceeding, the compile should occur happily.

testClassFileSynchronization

public void testClassFileSynchronization()
                                  throws BadLocationException,
                                         IOException,
                                         InterruptedException
After creating a new file, saving, and compiling it, this test checks that the new document is in sync after compiling and is out of sync after modifying and even saving it.

testClassFileSynchronizationAfterRename

public void testClassFileSynchronizationAfterRename()
                                             throws BadLocationException,
                                                    IOException,
                                                    IllegalStateException,
                                                    InterruptedException
Ensure that renaming a file makes it out of sync with its class file.

testCompileAfterFileMoved

public void testCompileAfterFileMoved()
                               throws BadLocationException,
                                      IOException
Tests a compile after a file has unexpectedly been moved or deleted.

testCompileReferenceToNonPublicClass

public void testCompileReferenceToNonPublicClass()
                                          throws BadLocationException,
                                                 IOException,
                                                 InterruptedException
Tests a compile on a file that references a non-public class defined in another class with a name different than the non-public class

testCompileWithJavaAssert

public void testCompileWithJavaAssert()
                               throws BadLocationException,
                                      IOException,
                                      InterruptedException
Test support for assert keyword if enabled. Note that this test only runs in Java 1.4 or higher.