Class TestWithReferenceDocument

java.lang.Object
junit.framework.Assert
junit.framework.TestCase
org.castor.xmlctf.TestWithReferenceDocument
All Implemented Interfaces:
junit.framework.Test

class TestWithReferenceDocument extends junit.framework.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: $
Author:
Sebastien Gignoux, Arnaud Blandin, Edward Kuns
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final String
    Class name of the ObjectModelBuilder.
    protected final FailureType
    The failure object that is not null is the test intends to fail.
    protected final String
    Gold file filename, really only useful if a class builder and no input file is given.
    protected final String
    Input file for test XML.
    protected final String
    Header of the name of all our output files ...
    protected final CastorTestCase
    Used only to retrieved the classloader.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Blank constructor for this test case.
    Constructs a test case that when invoked will delegate to the provided test case.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Runs our test case using our delegate object where necessary.
    protected void
    Provides setup for our delegated test case, depending on the type of test case we are delegating for.
    protected void
    Provides tear down for our delegated test case, depending on the type of test case we are delegating for.

    Methods inherited from class junit.framework.TestCase

    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, setName, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • _test

      protected final CastorTestCase _test
      Used only to retrieved the classloader.
    • _failure

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

      protected final String _builderClassName
      Class name of the ObjectModelBuilder.
    • _outputName

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

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

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

    • TestWithReferenceDocument

      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

      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

    • setUp

      protected void setUp() throws Exception
      Provides setup for our delegated test case, depending on the type of test case we are delegating for.
      Overrides:
      setUp in class junit.framework.TestCase
      Throws:
      Exception - if anything goes wrong during setup
    • 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.
      Overrides:
      tearDown in class junit.framework.TestCase
      Throws:
      Exception - if anything goes wrong during teardown
    • 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

      Overrides:
      runTest in class junit.framework.TestCase
      Throws:
      Exception - if anything goes wrong