org.castor.xmlctf

Class TestWithReferenceDocument


(package private) class TestWithReferenceDocument
extends TestCase

Implements a test case that tests code written by the XML source generator. This class uses the generated source to read and write an XML document, comparing the XML document written against the reference document that was originally read in.

The test follows this sequence:

  1. Unmarshals the given input file (if any).
  2. Compare the result object with the provided object model (if any).
  3. Marshals the object to a file.
  4. Unmarshals the created file.
  5. Check that the result object is equal to the start object.
Version:
$Revision: 0000 $ $Date: $
Authors:
Sebastien Gignoux
Arnaud Blandin
Edward Kuns

Field Summary

protected String
_builderClassName
Class name of the ObjectModelBuilder.
protected FailureType
_failure
The failure object that is not null is the test intends to fail.
protected String
_goldFileName
Gold file filename, really only useful if a class builder and no input file is given.
protected String
_inputName
Input file for test XML.
protected String
_outputName
Header of the name of all our output files ...
protected CastorTestCase
_test
Used only to retrieved the classloader.

Constructor Summary

TestWithReferenceDocument(String name)
Blank constructor for this test case.
TestWithReferenceDocument(String name, XMLTestCase tc)
Constructs a test case that when invoked will delegate to the provided test case.

Method Summary

void
runTest()
Runs our test case using our delegate object where necessary.
protected void
setUp()
Provides setup for our delegated test case, depending on the type of test case we are delegating for.
protected void
tearDown()
Provides tear down for our delegated test case, depending on the type of test case we are delegating for.

Field Details

_builderClassName

protected final String _builderClassName
Class name of the ObjectModelBuilder.

_failure

protected final FailureType _failure
The failure object that is not null is the test intends to fail.

_goldFileName

protected final String _goldFileName
Gold file filename, really only useful if a class builder and no input file is given.

_inputName

protected final String _inputName
Input file for test XML. (May be null if the builder class is provided.)

_outputName

protected final String _outputName
Header of the name of all our output files ... marshaled and dumped.

_test

protected final CastorTestCase _test
Used only to retrieved the classloader.

Constructor Details

TestWithReferenceDocument

(package private)  TestWithReferenceDocument(String name)
Blank constructor for this test case. This contructor is not useful, since no delegate test case is provided.
Parameters:
name - Name of our delegate test case

TestWithReferenceDocument

(package private)  TestWithReferenceDocument(String name,
                                             XMLTestCase tc)
Constructs a test case that when invoked will delegate to the provided test case.
Parameters:
name - Name of our delegate test case
tc -

Method Details

runTest

public void runTest()
            throws Exception
Runs our test case using our delegate object where necessary.

FIXME: Fix this so it throws only specific and necessary exceptions


setUp

protected void setUp()
            throws Exception
Provides setup for our delegated test case, depending on the type of test case we are delegating for.

tearDown

protected void tearDown()
            throws Exception
Provides tear down for our delegated test case, depending on the type of test case we are delegating for.

Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com