junit.framework.Test
MarshallingFrameworkTestCase
, OnlySourceGenerationTestCase
, SchemaTestCase
, SourceGeneratorTestCase
, TestSourceGenerator
public abstract class XMLTestCase
extends junit.framework.TestCase
This class is not complete and expects to be extended.
Modifier and Type | Field | Description |
---|---|---|
protected Configuration |
_configuration |
The Configuration the Marshalling Framework.
|
protected FailureType |
_failure |
The failure object that is not null if the test is expected to fail.
|
protected boolean |
_hasDump |
If true, the dumpFields() function has been implemented in the root class.
|
protected java.lang.Object |
_listener |
A listener for marshalling.
|
protected java.lang.String |
_listenerGoldFile |
Gold file for listener.
|
protected TypeType |
_listenerType |
Type of listener test -- Marshal, Unmarshal or Both.
|
protected Mapping |
_mapping |
The name of the mapping file to use in a Marshalling Framework Test Case.
|
protected java.lang.String |
_name |
Name of this test.
|
protected java.io.File |
_outputRootFile |
Place where the temporary file have to be put.
|
protected static boolean |
_printStack |
True if we dump the stack trace for any exception that occurs during testing.
|
protected java.lang.Class |
_rootClass |
The root class for this test.
|
protected java.lang.String |
_rootClassName |
The name of the root class for this test.
|
protected boolean |
_skip |
True if the test needs to be skipped.
|
protected java.lang.String |
_suiteName |
Name of the test suite to which this test belongs.
|
protected CastorTestCase |
_test |
Used only to retrieve the classloader.
|
protected UnitTestCase |
_unitTest |
The unit test case this class represent.
|
static boolean |
_verbose |
True if we desire a lot of info on what happen.
|
Constructor | Description |
---|---|
XMLTestCase(java.lang.String name) |
Instantiate a new XMLTestCase with the given name.
|
XMLTestCase(java.lang.String name,
XMLTestCase tc) |
Instantiates a new test cases that has the same configuration of the given
test case.
|
XMLTestCase(CastorTestCase test,
UnitTestCase unit) |
Instantiates a new test case that represents the given UnitTestCase.
|
Modifier and Type | Method | Description |
---|---|---|
protected java.lang.Object |
buildObjectModel(java.lang.String builderName) |
Returns an instance of the object model hardcoded in the given
ObjectModelBuilder.
|
protected boolean |
checkExceptionWasExpected(java.lang.Exception exception,
FailureStepType checkStep) |
Called when a test case throws an Exception.
|
(package private) static java.lang.String |
cleanup(java.lang.String name) |
Returns a version of the input name that is suitable for JUnit test case
or test suite use.
|
java.lang.String |
getTestSuiteName() |
Returns the name of the test suite to which this test case belongs to.
|
XMLContext |
getXMLContext() |
|
protected void |
initializeListeners(ListenerType listener) |
Initialize listeners for marshalling/unmarshalling
|
protected java.util.List |
invokeEnumeratedMethods(java.lang.Object objectInvoked,
ConfigurationType config) |
Invokes all requested methods on the object we are supplied.
|
void |
setTestSuiteName(java.lang.String suiteName) |
Sets the name of the test suite to which this test case belongs to.
|
protected abstract void |
setUp() |
|
void |
setXMLContext(XMLContext xmlContext) |
|
protected abstract void |
tearDown() |
|
protected java.io.File |
testMarshal(java.lang.Object object,
java.lang.String fileName) |
Marshals the object with the configuration of the test.
|
protected java.lang.Object |
testUnmarshal(java.io.File file) |
Unmarshals the given file with the configuration of that test.
|
protected java.lang.Object |
testUnmarshal(java.io.InputStream stream) |
Unmarshals the given input stream with the configuration of that test.
|
protected void |
verbose(java.lang.String message) |
print the message if in verbose mode.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, toString
public static boolean _verbose
protected static boolean _printStack
protected java.lang.String _suiteName
protected java.lang.String _rootClassName
protected java.lang.Class _rootClass
protected boolean _hasDump
protected Mapping _mapping
protected java.lang.Object _listener
protected TypeType _listenerType
protected java.lang.String _listenerGoldFile
protected Configuration _configuration
protected final java.lang.String _name
protected final UnitTestCase _unitTest
protected final java.io.File _outputRootFile
protected final boolean _skip
protected final FailureType _failure
protected final CastorTestCase _test
public XMLTestCase(java.lang.String name)
name
- the name of this test case.public XMLTestCase(CastorTestCase test, UnitTestCase unit)
test
- the reference to the jar/directoryunit
- the UnitTestCase that wraps the configuration for this XML Test case.public XMLTestCase(java.lang.String name, XMLTestCase tc)
name
- the name of the test casetc
- the XML test case that hold the configuration for this test caseprotected abstract void setUp() throws java.lang.Exception
setUp
in class junit.framework.TestCase
java.lang.Exception
protected abstract void tearDown() throws java.lang.Exception
tearDown
in class junit.framework.TestCase
java.lang.Exception
public void setXMLContext(XMLContext xmlContext)
public XMLContext getXMLContext()
static java.lang.String cleanup(java.lang.String name)
We also translate all whitespace to blanks, remove all leading and trailing whitespace, and collapse consecutive whitespace to a single blank.
name
- the input namepublic void setTestSuiteName(java.lang.String suiteName)
suiteName
- the name of the test suite.public java.lang.String getTestSuiteName()
protected boolean checkExceptionWasExpected(java.lang.Exception exception, FailureStepType checkStep)
exception
- the Exception that was throwncheckStep
- the test step that threw an Exceptionprotected java.io.File testMarshal(java.lang.Object object, java.lang.String fileName)
object
- the object to marshall.fileName
- the name of the file where to marshall the object.protected java.lang.Object testUnmarshal(java.io.File file) throws java.lang.Exception
file
- the file containing the xml document to unmarshall.java.lang.Exception
- if anything goes wrong during the testprotected java.lang.Object testUnmarshal(java.io.InputStream stream) throws java.lang.Exception
stream
- the input stream containing the xml document to unmarshall.java.lang.Exception
- if anything goes wrong during the testprotected java.util.List invokeEnumeratedMethods(java.lang.Object objectInvoked, ConfigurationType config) throws java.lang.Exception
objectInvoked
- the object on which to invoke the methodsconfig
- configuration object listing the methods we are to calljava.lang.Exception
- if anything goes wrong during the testprotected void initializeListeners(ListenerType listener) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException
listener
- the listener to initializejava.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
protected java.lang.Object buildObjectModel(java.lang.String builderName) throws java.lang.Exception
builderName
- the name of the class used as a builderjava.lang.Exception
- if anything goes wrong during the testprotected void verbose(java.lang.String message)
message
- the message to printIntalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com