Class TestWithRandomObject

  • All Implemented Interfaces:
    junit.framework.Test

    class TestWithRandomObject
    extends junit.framework.TestCase
    Implements a test case that tests code written by the XML source generator. This class uses the generated source to write a randomly generated XML element to a file.

    The test follows this sequence:

    1. Instantiates a random object model using the randomize function.
    2. Marshals it to a file.
    3. Unmarshals the created file.
    4. 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 FailureType _failure
      The failure object that is not null is the test intends to fail.
      protected java.lang.String _outputName
      File name of our marshaled output.
    • Constructor Summary

      Constructors 
      Constructor Description
      TestWithRandomObject​(java.lang.String name)
      Blank constructor for this test case.
      TestWithRandomObject​(java.lang.String name, XMLTestCase tc)
      Constructs a test case that when invoked will delegate to the provided test case.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      • 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 Detail

      • _failure

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

        protected final java.lang.String _outputName
        File name of our marshaled output.
    • Constructor Detail

      • TestWithRandomObject

        TestWithRandomObject​(java.lang.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
      • TestWithRandomObject

        TestWithRandomObject​(java.lang.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 Detail

      • setUp

        protected void setUp()
                      throws java.lang.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:
        java.lang.Exception - if anything goes wrong during setup
      • tearDown

        protected void tearDown()
                         throws java.lang.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:
        java.lang.Exception - if anything goes wrong during teardown
      • runTest

        public void runTest()
                     throws java.lang.Exception
        Runs our test case using our delegate object where necessary.
        Overrides:
        runTest in class junit.framework.TestCase
        Throws:
        java.lang.Exception