|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--junit.framework.Assert | +--junit.framework.TestCase | +--edu.rice.cs.drjava.model.GlobalModelTestCase
Base class for tests over the GlobalModel
.
This class provides a number of convenience methods for testing the
GlobalModel. It also contains a model instance (reset in setUp()
and a temporary directory that's created per test invocation (and
subsequently cleaned in tearDown()
. This reduces the burden
for such file management stuff in the test cases themselves.
Inner Class Summary | |
class |
GlobalModelTestCase.CancelingSelector
|
static class |
GlobalModelTestCase.CompileShouldFailListener
A model listener for situations expecting a compilation to fail. |
static class |
GlobalModelTestCase.CompileShouldSucceedListener
|
class |
GlobalModelTestCase.FileSelector
this class is used by several test cases in Compile Tests that expect incorrect behavior concerning the saving of files. |
class |
GlobalModelTestCase.OpenWarningException
|
class |
GlobalModelTestCase.OverwriteException
|
static class |
GlobalModelTestCase.TestListener
A GlobalModelListener for testing. |
class |
GlobalModelTestCase.WarningFileSelector
|
Field Summary | |
protected DefaultGlobalModel |
_model
|
protected static DefaultGlobalModel |
_originalModel
the prototype global model to hold the interpreter. |
protected File |
_tempDir
|
protected static String |
BAR_TEXT
|
protected static String |
BAZ_TEXT
|
protected static String |
FOO_MISSING_CLOSE_TEXT
|
protected static String |
FOO_PACKAGE_AFTER_IMPORT
|
protected static String |
FOO_PACKAGE_AS_FIELD
|
protected static String |
FOO_PACKAGE_AS_FIELD_2
|
protected static String |
FOO_PACKAGE_AS_PART_OF_FIELD
|
protected static String |
FOO_PACKAGE_INSIDE_CLASS
|
protected static String |
FOO_TEXT
|
Fields inherited from class junit.framework.TestCase |
fName |
Constructor Summary | |
GlobalModelTestCase(String name)
Constructor. |
Method Summary | |
protected void |
assertCompileErrorsPresent(boolean b)
|
protected void |
assertCompileErrorsPresent(String name,
boolean b)
|
protected void |
assertContents(String s,
OpenDefinitionsDocument doc)
|
protected void |
assertLength(int len,
OpenDefinitionsDocument doc)
|
protected void |
assertModified(boolean b,
OpenDefinitionsDocument doc)
|
protected void |
assertNumOpenDocs(int num)
|
protected void |
changeDocumentText(String s,
OpenDefinitionsDocument doc)
Clear all old text and insert the given text. |
protected File |
classForJava(File sourceFile,
String className)
Given a .java file and a class file name, returns the corresponding .class file. |
protected File |
createFile(String name)
|
protected void |
createModel()
Instantiates the GlobalModel to be used in the test cases. |
protected String |
interpret(String input)
Puts the given input into the interactions document and then interprets it, returning the result that was put into the interactions document. |
protected void |
interpretIgnoreResult(String input)
|
protected void |
setUp()
Setup for each test case, which does the following. |
protected OpenDefinitionsDocument |
setupDocument(String text)
Creates and returns a new document, makes sure newFile is fired, and then adds some text. |
protected void |
tearDown()
Teardown for each test case, which recursively deletes the temporary directory created in setUp. |
protected File |
tempDirectory()
Create a new temporary directory in _tempDir. |
protected File |
tempFile()
Create a new temporary file in _tempDir. |
protected File |
tempFile(int i)
Create a new temporary file in _tempDir. |
protected File |
writeToNewTempFile(String text)
Creates a new temporary file and writes the given text to it. |
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 |
|
Field Detail |
protected static final DefaultGlobalModel _originalModel
protected DefaultGlobalModel _model
protected File _tempDir
protected static final String FOO_TEXT
protected static final String BAR_TEXT
protected static final String BAZ_TEXT
protected static final String FOO_MISSING_CLOSE_TEXT
protected static final String FOO_PACKAGE_AFTER_IMPORT
protected static final String FOO_PACKAGE_INSIDE_CLASS
protected static final String FOO_PACKAGE_AS_FIELD
protected static final String FOO_PACKAGE_AS_FIELD_2
protected static final String FOO_PACKAGE_AS_PART_OF_FIELD
Constructor Detail |
public GlobalModelTestCase(String name)
String
- nameMethod Detail |
protected void setUp() throws IOException
_model
for each test case run.
_tempDir
.
setUp
in class TestCase
protected void tearDown() throws IOException
tearDown
in class TestCase
protected void createModel()
protected void changeDocumentText(String s, OpenDefinitionsDocument doc) throws BadLocationException
protected File tempFile() throws IOException
protected File tempFile(int i) throws IOException
protected File tempDirectory() throws IOException
protected File createFile(String name)
protected File classForJava(File sourceFile, String className)
protected File writeToNewTempFile(String text) throws IOException
protected OpenDefinitionsDocument setupDocument(String text) throws BadLocationException
protected String interpret(String input) throws BadLocationException
input
- text to interpretprotected void interpretIgnoreResult(String input) throws BadLocationException
protected void assertNumOpenDocs(int num)
protected void assertModified(boolean b, OpenDefinitionsDocument doc)
protected void assertLength(int len, OpenDefinitionsDocument doc) throws BadLocationException
protected void assertContents(String s, OpenDefinitionsDocument doc) throws BadLocationException
protected void assertCompileErrorsPresent(boolean b)
protected void assertCompileErrorsPresent(String name, boolean b)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |