edu.rice.cs.drjava.model
Class GlobalModelJUnitTest

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.GlobalModelJUnitTest
All Implemented Interfaces:
Test

public final class GlobalModelJUnitTest
extends GlobalModelTestCase

A test of Junit testing support in the GlobalModel.

Version:
$Id: GlobalModelJUnitTest.java 5236 2010-04-27 01:43:36Z mgricken $

Nested Class Summary
 class GlobalModelJUnitTest.JUnitCompileBeforeTestListener
          Tests that testing an uncompiled but correct group of files will first compile and then run test.
 
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.SaveCopyFileSelector, GlobalModelTestCase.TestGlobalModel, GlobalModelTestCase.TestListener, GlobalModelTestCase.WarningFileSelector
 
Nested classes/interfaces inherited from class junit.framework.TestCase
TestCase.WrappedException
 
Field Summary
private static Log _log
           
private static java.lang.String ELSPETH_ERROR_TEXT
           
private static java.lang.String HAS_MULTIPLE_TESTS_PASS_TEXT
           
private static java.lang.String MONKEYTEST_ERROR_TEXT
           
private static java.lang.String MONKEYTEST_FAIL_TEXT
           
private static java.lang.String MONKEYTEST_INFINITE_TEXT
           
private static java.lang.String MONKEYTEST_PASS_ALT_TEXT
           
private static java.lang.String MONKEYTEST_PASS_TEXT
           
private static java.lang.String MULTI_CLASSES_IN_FILE_TEXT
           
private static java.lang.String NON_TESTCASE_TEXT
           
private static java.lang.String NONPUBLIC_TEXT
           
(package private) static boolean printMessages
          Whether or not to print debugging output.
private static java.lang.String STATIC_INNER_TEST_TEXT
           
 
Fields inherited from class edu.rice.cs.drjava.model.GlobalModelTestCase
_doc, _interactionsController, _model, _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 edu.rice.cs.drjava.model.MultiThreadedTestCase
_testFailed
 
Constructor Summary
GlobalModelJUnitTest()
           
 
Method Summary
 void safeJUnitAllWithErrors()
          Tests that junit all works with test cases that do not pass.
 void safeJUnitAllWithNoErrors()
          Tests that junit all works with one or two test cases that should pass.
 void safeJUnitAllWithNoValidTests()
          Verifies that we get a nonTestCase event and that opening a single test file enables testing.
 void safeJUnitStaticInnerClass()
          Tests that junit all works with one or two test cases that should pass.
 void testCorrectFilesAfterIncorrectChanges_NOJOIN()
          Tests that when a JUnit file with no errors is compiled and then modified to contain an error does not pass unit testing (by running correct class files).
 void testElspethOneJUnitError_NOJOIN()
          Tests that a JUnit file with an error is reported to have an error.
 void testInfiniteLoop_NOJOIN()
          Tests that an infinite loop in a test case can be aborted by clicking the Reset button.
 void testJUnit4MultiTest_NOJOIN()
          Tests to see if a JUnit4 style test with multiple test cases passes
 void testJUnit4NoTest_NOJOIN()
          Tests to see if a JUnit4 style test with no test cases will not run
 void testJUnit4StyleTestWorks_NOJOIN()
           
 void testJUnit4TwoMethod1Test_NOJOIN()
          Tests to see if a JUnit4 style test with a test method and multiple nonTest methods will run
 void testNoClassFile()
          Tests a document that has no corresponding class file.
 void testNoJUnitErrors_NOJOIN()
          Tests that a JUnit file with no errors is reported to have no errors.
 void testNonTestCaseError_NOJOIN()
          Tests that the ui is notified to put up an error dialog if JUnit is run on a non-TestCase.
 void testOneJUnitError_NOJOIN()
          Tests that a JUnit file with an error is reported to have an error.
 void testRealError_NOJOIN()
          Tests that a test class which throws a *real* Error (not an Exception) is handled correctly.
 void testResultOfNonPublicTestCase_NOJOIN()
          Tests that the ui is notified to put up an error dialog if JUnit is run on a non-public TestCase.
 void testUnsavedAndUnCompiledChanges()
          Tests that when a JUnit file with no errors, after being saved and compiled, has it's contents replaced by a test that should fail, will pass all tests.
 
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, saveFileCopy, setUp, setupDocument, tearDown, tempDirectory, tempFile, tempFile, testStartCompile, writeToNewTempFile
 
Methods inherited from class edu.rice.cs.drjava.model.MultiThreadedTestCase
join, listenerFail, 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
 

Field Detail

_log

private static Log _log

printMessages

static final boolean printMessages
Whether or not to print debugging output.

See Also:
Constant Field Values

ELSPETH_ERROR_TEXT

private static final java.lang.String ELSPETH_ERROR_TEXT
See Also:
Constant Field Values

MONKEYTEST_PASS_TEXT

private static final java.lang.String MONKEYTEST_PASS_TEXT
See Also:
Constant Field Values

MONKEYTEST_PASS_ALT_TEXT

private static final java.lang.String MONKEYTEST_PASS_ALT_TEXT
See Also:
Constant Field Values

MONKEYTEST_FAIL_TEXT

private static final java.lang.String MONKEYTEST_FAIL_TEXT
See Also:
Constant Field Values

MONKEYTEST_ERROR_TEXT

private static final java.lang.String MONKEYTEST_ERROR_TEXT
See Also:
Constant Field Values

NONPUBLIC_TEXT

private static final java.lang.String NONPUBLIC_TEXT
See Also:
Constant Field Values

NON_TESTCASE_TEXT

private static final java.lang.String NON_TESTCASE_TEXT
See Also:
Constant Field Values

MONKEYTEST_INFINITE_TEXT

private static final java.lang.String MONKEYTEST_INFINITE_TEXT
See Also:
Constant Field Values

HAS_MULTIPLE_TESTS_PASS_TEXT

private static final java.lang.String HAS_MULTIPLE_TESTS_PASS_TEXT
See Also:
Constant Field Values

STATIC_INNER_TEST_TEXT

private static final java.lang.String STATIC_INNER_TEST_TEXT
See Also:
Constant Field Values

MULTI_CLASSES_IN_FILE_TEXT

private static final java.lang.String MULTI_CLASSES_IN_FILE_TEXT
See Also:
Constant Field Values
Constructor Detail

GlobalModelJUnitTest

public GlobalModelJUnitTest()
Method Detail

testNoJUnitErrors_NOJOIN

public void testNoJUnitErrors_NOJOIN()
                              throws java.lang.Exception
Tests that a JUnit file with no errors is reported to have no errors.

Throws:
java.lang.Exception

testOneJUnitError_NOJOIN

public void testOneJUnitError_NOJOIN()
                              throws java.lang.Exception
Tests that a JUnit file with an error is reported to have an error.

Throws:
java.lang.Exception

testElspethOneJUnitError_NOJOIN

public void testElspethOneJUnitError_NOJOIN()
                                     throws java.lang.Exception
Tests that a JUnit file with an error is reported to have an error.

Throws:
java.lang.Exception

testRealError_NOJOIN

public void testRealError_NOJOIN()
                          throws java.lang.Exception
Tests that a test class which throws a *real* Error (not an Exception) is handled correctly.

Throws:
java.lang.Exception

testNonTestCaseError_NOJOIN

public void testNonTestCaseError_NOJOIN()
                                 throws java.lang.Exception
Tests that the ui is notified to put up an error dialog if JUnit is run on a non-TestCase.

Throws:
java.lang.Exception

testResultOfNonPublicTestCase_NOJOIN

public void testResultOfNonPublicTestCase_NOJOIN()
                                          throws java.lang.Exception
Tests that the ui is notified to put up an error dialog if JUnit is run on a non-public TestCase.

Throws:
java.lang.Exception

testNoClassFile

public void testNoClassFile()
                     throws java.lang.Exception
Tests a document that has no corresponding class file.

Throws:
java.lang.Exception

testInfiniteLoop_NOJOIN

public void testInfiniteLoop_NOJOIN()
                             throws java.lang.Exception
Tests that an infinite loop in a test case can be aborted by clicking the Reset button.

Throws:
java.lang.Exception

testUnsavedAndUnCompiledChanges

public void testUnsavedAndUnCompiledChanges()
                                     throws java.lang.Exception
Tests that when a JUnit file with no errors, after being saved and compiled, has it's contents replaced by a test that should fail, will pass all tests.

Throws:
java.lang.Exception

safeJUnitAllWithNoValidTests

public void safeJUnitAllWithNoValidTests()
                                  throws java.lang.Exception
Verifies that we get a nonTestCase event and that opening a single test file enables testing.

Throws:
java.lang.Exception

safeJUnitAllWithNoErrors

public void safeJUnitAllWithNoErrors()
                              throws java.lang.Exception
Tests that junit all works with one or two test cases that should pass.

Throws:
java.lang.Exception

safeJUnitAllWithErrors

public void safeJUnitAllWithErrors()
                            throws java.lang.Exception
Tests that junit all works with test cases that do not pass.

Throws:
java.lang.Exception

safeJUnitStaticInnerClass

public void safeJUnitStaticInnerClass()
                               throws java.lang.Exception
Tests that junit all works with one or two test cases that should pass.

Throws:
java.lang.Exception

testCorrectFilesAfterIncorrectChanges_NOJOIN

public void testCorrectFilesAfterIncorrectChanges_NOJOIN()
                                                  throws java.lang.Exception
Tests that when a JUnit file with no errors is compiled and then modified to contain an error does not pass unit testing (by running correct class files).

Throws:
java.lang.Exception

testJUnit4StyleTestWorks_NOJOIN

public void testJUnit4StyleTestWorks_NOJOIN()
                                     throws java.lang.Exception
Throws:
java.lang.Exception

testJUnit4MultiTest_NOJOIN

public void testJUnit4MultiTest_NOJOIN()
                                throws java.lang.Exception
Tests to see if a JUnit4 style test with multiple test cases passes

Throws:
java.lang.Exception

testJUnit4NoTest_NOJOIN

public void testJUnit4NoTest_NOJOIN()
                             throws java.lang.Exception
Tests to see if a JUnit4 style test with no test cases will not run

Throws:
java.lang.Exception

testJUnit4TwoMethod1Test_NOJOIN

public void testJUnit4TwoMethod1Test_NOJOIN()
                                     throws java.lang.Exception
Tests to see if a JUnit4 style test with a test method and multiple nonTest methods will run

Throws:
java.lang.Exception