edu.rice.cs.drjava.model
Class GlobalModelCompileErrorsTest

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.model.MultiThreadedTestCase
                  extended by edu.rice.cs.drjava.model.GlobalModelTestCase
                      extended by edu.rice.cs.drjava.model.GlobalModelCompileErrorsTest
All Implemented Interfaces:
Test

public final class GlobalModelCompileErrorsTest
extends GlobalModelTestCase

Tests to ensure that compilation fails when expected, and that the errors are reported correctly. Every test in this class is run for *each* of the compilers that is available.

Version:
$Id: GlobalModelCompileErrorsTest.java 4691 2008-12-02 23:33:27Z dlsmith $

Nested Class Summary
 
Nested classes/interfaces inherited from class edu.rice.cs.drjava.model.GlobalModelTestCase
GlobalModelTestCase.CancelingSelector, GlobalModelTestCase.CompileShouldFailListener, GlobalModelTestCase.CompileShouldSucceedListener, GlobalModelTestCase.FileMovedWarningException, GlobalModelTestCase.FileSelector, GlobalModelTestCase.InteractionListener, GlobalModelTestCase.JUnitNonTestListener, GlobalModelTestCase.JUnitTestListener, GlobalModelTestCase.OpenWarningException, GlobalModelTestCase.OverwriteException, GlobalModelTestCase.TestGlobalModel, GlobalModelTestCase.TestListener, GlobalModelTestCase.WarningFileSelector
 
Field Summary
 
Fields inherited from class edu.rice.cs.drjava.model.GlobalModelTestCase
_doc, _interactionsController, _log, _model, _tempDir, BAR_TEXT, BAZ_TEXT, FOO_PACKAGE_AS_PART_OF_FIELD, FOO_TEXT
 
Fields inherited from class edu.rice.cs.drjava.model.MultiThreadedTestCase
_testFailed
 
Fields inherited from class edu.rice.cs.drjava.DrJavaTestCase
TEST_DRJAVA_CONFIG_PROPERTY
 
Constructor Summary
GlobalModelCompileErrorsTest()
           
 
Method Summary
 void testCompileAllFailsDifferentSourceRoots()
          Tests calling compileAll with different source roots works if the files have errors in them.
 void testCompileFailsCorrectLineNumbers()
          Tests the compiler errors have the correct line numbers.
 void testCompileMissingCloseCurly()
          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 testCompileWithPackageStatementInsideClass()
          Puts an otherwise valid package statement inside a class declaration.
 
Methods inherited from class edu.rice.cs.drjava.model.GlobalModelTestCase
assertCompileErrorsPresent, assertCompileErrorsPresent, assertContents, assertInteractionsContains, assertInteractionsDoesNotContain, assertInteractionsDoesNotMatch, assertInteractionsMatches, assertLength, assertModified, assertNumOpenDocs, changeDocumentText, classForJava, createFile, doCompile, doCompile, getCompilerErrorString, getInteractionsText, interpret, interpretIgnoreResult, safeLoadHistory, safeSaveHistory, saveAllFiles, saveFile, saveFileAs, setUp, setupDocument, tearDown, tempDirectory, tempFile, tempFile, testStartCompile, writeToNewTempFile
 
Methods inherited from class edu.rice.cs.drjava.model.MultiThreadedTestCase
join, listenerFail, wait
 
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
 

Constructor Detail

GlobalModelCompileErrorsTest

public GlobalModelCompileErrorsTest()
Method Detail

testCompileAllFailsDifferentSourceRoots

public void testCompileAllFailsDifferentSourceRoots()
                                             throws BadLocationException,
                                                    IOException,
                                                    InterruptedException
Tests calling compileAll with different source roots works if the files have errors in them. (Each file has 1 error.) Note that this testcase will fail if several compilers can be found through the .drjava file. As the test is then run one time per compiler it can find.

Throws:
BadLocationException
IOException
InterruptedException

testCompilePackageAsField

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

Throws:
BadLocationException
IOException
InterruptedException

testCompilePackageAsField2

public void testCompilePackageAsField2()
                                throws BadLocationException,
                                       IOException,
                                       InterruptedException
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.

Throws:
BadLocationException
IOException
InterruptedException

testCompileMissingCloseCurly

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

Throws:
BadLocationException
IOException
InterruptedException

testCompileWithPackageStatementInsideClass

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

Throws:
BadLocationException
IOException
InterruptedException

testCompileFailsCorrectLineNumbers

public void testCompileFailsCorrectLineNumbers()
                                        throws BadLocationException,
                                               IOException,
                                               InterruptedException
Tests the compiler errors have the correct line numbers. TODO: rewrite this test for the new error model interface

Throws:
BadLocationException
IOException
InterruptedException