Class AntUnitTestCase

  • All Implemented Interfaces:
    junit.framework.Test

    public class AntUnitTestCase
    extends junit.framework.TestCase
    JUnit TestCase that will executes a single AntUnit target.

    This class is not supposed to be used directly.

    It is public only because junit must access it as a public.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) static class  AntUnitTestCase.TestCaseName
      Handle the serialization and the parsing of the name of a TestCase.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private org.apache.tools.ant.BuildException initialisationException
      Store the exception when the project can not be parsed, but only if this class has been created directly by the IDE from its name.
      private AntUnitSuite suite
      AntUnitSuite that contains this AntUnitTestCase.
      private java.lang.String target
      The test target
    • Constructor Summary

      Constructors 
      Constructor Description
      AntUnitTestCase​(java.lang.String name)
      Prepare an AntUnitTestCase that will be executed alone.
      AntUnitTestCase​(AntUnitSuite suite, java.io.File scriptFile, java.lang.String target)
      Prepare an AntUnitTestCase that will be executed in a suite.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getTarget()
      Get the AntUnit test target name.
      void run​(junit.framework.TestResult result)
      Called by a Junit Runner that want to executes specifically this test target.
      protected void runTest()
      Normally never used because this object delegates all execution to an AntUnitSuite.
      • 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, runBare, setName, setUp, tearDown, toString
      • Methods inherited from class java.lang.Object

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

      • suite

        private final AntUnitSuite suite
        AntUnitSuite that contains this AntUnitTestCase. Execution is done via this suite
      • target

        private final java.lang.String target
        The test target
      • initialisationException

        private final org.apache.tools.ant.BuildException initialisationException
        Store the exception when the project can not be parsed, but only if this class has been created directly by the IDE from its name. In case of initialisation problem when the test is build from the suite, the problem is handled at the level of the suite (and this object is never created)
    • Constructor Detail

      • AntUnitTestCase

        public AntUnitTestCase​(java.lang.String name)
        Prepare an AntUnitTestCase that will be executed alone.

        This constructor is typically used by a junit 3 runner that will reexecute a specific test.

        The execution of this test will be embed in a suiteSetUp and suiteTearDown.

        Parameters:
        name - The name of the AntUnitTestCase, normally obtained from a previous execution.
      • AntUnitTestCase

        public AntUnitTestCase​(AntUnitSuite suite,
                               java.io.File scriptFile,
                               java.lang.String target)
        Prepare an AntUnitTestCase that will be executed in a suite. It is the suite that prepare the antScriptRunner and the JUnitExcutionPlatform. It is the responsibility of the suite to execute the suiteSetUp and the suiteTearDown.
        Parameters:
        target - test target
        suite - test suite
        scriptFile - test file
    • Method Detail

      • getTarget

        public java.lang.String getTarget()
        Get the AntUnit test target name.
        Returns:
        target name
      • run

        public void run​(junit.framework.TestResult result)
        Called by a Junit Runner that want to executes specifically this test target.

        This implementation delegates the call to the suite.

        Specified by:
        run in interface junit.framework.Test
        Overrides:
        run in class junit.framework.TestCase
      • runTest

        protected void runTest()
                        throws org.apache.tools.ant.BuildException
        Normally never used because this object delegates all execution to an AntUnitSuite. However, when the suite can not be created (because the ant project is invalid), this object is executed and just throws the exception.
        Overrides:
        runTest in class junit.framework.TestCase
        Throws:
        org.apache.tools.ant.BuildException