junit.framework
Class TestCase

java.lang.Object
  |
  +--ccl.util.Test
        |
        +--junit.framework.TestCase
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
AssertTestCase

public class TestCase
extends Test

This class is a fake for JUnit test classes. It redirects all your test code to use the test class from the ccl.util.Test class.

To execute your tests written for the JUnit API with the ccl.util.Test class, write code like this:

     public void main( String[] args ) {
         TestCase testCase = new MyTest();
         testCase.setVerbose( true );
         testCase.setTiming ( true );
         testCase.run();
         testCase.printResults();
 
         System.exit( 0 );
     }
 

See Also:
for details how to build a hierarchy of tests

Constructor Summary
TestCase()
          Default constructor expected in Test.
TestCase(java.lang.String testName)
          Standard constructor expected in JUnit TestCase.
TestCase(Test test)
          Standard constructor expected in Test.
 
Method Summary
protected  void _doIt()
          This method gets invoked from the ccl.util.Test class and is responsible for executed all test code.
 void assert(java.lang.String message, boolean check)
          Maps the JUnit standard assertion to Test's assertion.
protected  void enterSubTest(java.lang.String testName)
          A workaround method to be able to use reflection to invoke the super method _enterSubTest.
protected  void exitSubTest()
          A workaround method to be able to use reflection to invoke the super method _exitSubTest.
static java.util.Vector getMethods(java.lang.Object object)
          Returns all public methods of an object.
static java.util.Vector getTestMethods(java.lang.Object object)
          Returns all methods of an object that conform to the test method convention.
 void invokeTestMethod(java.lang.reflect.Method testMethod)
          Used to invoke the test methods.
static void invokeTestMethod(java.lang.reflect.Method testMethod, java.lang.Object object)
          Used to invoke the test methods.
 
Methods inherited from class ccl.util.Test
_enterSubTest, _exitSubTest, _getValue, _increment, _setTests, _showLiveSignals, assert, Assert, assert, Assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertTrue, assertTrue, assertTrue, bug, bugIf, bugIf, bugIf, fail, fail, getBugs, getComment, getGlobalTests, getLocalTests, getName, getTestClassDirectory, getTestDirectory, getTestName, getTestName, getValue, initialize, isTest, isTiming, isVerbose, printResult, printResult, redirectStandardStreams, run, setBug, setParentTest, setTests, setTiming, setValue, setVerbose, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TestCase

public TestCase()
Default constructor expected in Test.


TestCase

public TestCase(Test test)
Standard constructor expected in Test.


TestCase

public TestCase(java.lang.String testName)
Standard constructor expected in JUnit TestCase.

Method Detail

_doIt

protected void _doIt()
              throws java.lang.Exception
This method gets invoked from the ccl.util.Test class and is responsible for executed all test code. We do it like junit and find via reflection all public void methods without parameters which start with 'test'. Alternatively, if a 'suite' method exists in the implemented test case class, then of course the test methods and classes specified there have to be used.

Specified by:
_doIt in class Test
Throws:
java.lang.Exception - Whatever can go wrong.

assert

public void assert(java.lang.String message,
                   boolean check)
Maps the JUnit standard assertion to Test's assertion.


enterSubTest

protected void enterSubTest(java.lang.String testName)
A workaround method to be able to use reflection to invoke the super method _enterSubTest.


exitSubTest

protected void exitSubTest()
A workaround method to be able to use reflection to invoke the super method _exitSubTest.


invokeTestMethod

public void invokeTestMethod(java.lang.reflect.Method testMethod)
                      throws java.lang.Exception
Used to invoke the test methods.

java.lang.Exception

invokeTestMethod

public static void invokeTestMethod(java.lang.reflect.Method testMethod,
                                    java.lang.Object object)
                             throws java.lang.Exception
Used to invoke the test methods.

java.lang.Exception

getTestMethods

public static java.util.Vector getTestMethods(java.lang.Object object)
Returns all methods of an object that conform to the test method convention.


getMethods

public static java.util.Vector getMethods(java.lang.Object object)
Returns all public methods of an object.