net.sourceforge.groboutils.junit.v1.parser
Class TestClassCreator

java.lang.Object
  extended bynet.sourceforge.groboutils.junit.v1.parser.TestClassCreator

public class TestClassCreator
extends java.lang.Object

Creates Test instances based on a TestClassParser.

Ripped the test method discovery code out of junit.framework.TestSuite to allow it to have usable logic.

This is not covered under the GroboUtils license, but rather under the JUnit license (IBM Public License). This heading may not be totally in line with the license, so I'll change it when I find out what needs to be changed.

Since:
November 4, 2002
Version:
$Date: 2003/02/10 22:52:21 $
Author:
Matt Albrecht groboclown@users.sourceforge.net

Constructor Summary
TestClassCreator(ITestCreator tc)
          Creates an instance that creates test instances based on the given creator.
 
Method Summary
 void clearWarnings()
          Remove all current warnings.
 junit.framework.TestSuite createAllTestSuite(TestClassParser tcp)
          Create a new TestSuite, containing the tests returned by the call to createTests() and createWarningTests.
 junit.framework.Test[] createTests(TestClassParser tcp)
          This will create all test objects for the test registered with the parser.
 junit.framework.TestSuite createTestSuite(TestClassParser tcp)
          Create a new TestSuite, containing the tests returned by the call to createTests().
static junit.framework.Test createWarningTest(java.lang.String message)
          Create a new Test that will fail with the given error message.
 junit.framework.Test[] createWarningTests(TestClassParser tcp)
          For every warning currently known in this creator and the parser, create a Test that fails with the warning's message.
 java.lang.String[] getWarnings()
          Retrieve all warnings generated during the introspection of the class, or test creation.
protected  void warning(java.lang.String message)
          Adds a warning message to the inner list of warnings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestClassCreator

public TestClassCreator(ITestCreator tc)
Creates an instance that creates test instances based on the given creator.

Throws:
java.lang.IllegalArgumentException - if theClass is null.
Method Detail

getWarnings

public java.lang.String[] getWarnings()
Retrieve all warnings generated during the introspection of the class, or test creation. If a clearWarnings() call was ever made, then only those warnings that were encountered after the call will be returned.

Returns:
an array of all warnings generated while creating the test array.

clearWarnings

public void clearWarnings()
Remove all current warnings.


createTests

public junit.framework.Test[] createTests(TestClassParser tcp)
This will create all test objects for the test registered with the parser. Any errors reported during generation will be added to the warnings list.

Returns:
all valid tests created through inspection.

createWarningTests

public junit.framework.Test[] createWarningTests(TestClassParser tcp)
For every warning currently known in this creator and the parser, create a Test that fails with the warning's message. Note that after creating a test with the warnings, this instance will still know about the warnings.

Returns:
an array of tests that fail with a particular warning.

createTestSuite

public junit.framework.TestSuite createTestSuite(TestClassParser tcp)
Create a new TestSuite, containing the tests returned by the call to createTests(). No warning tests will be added.

Returns:
a new TestSuite with all the valid, discovered tests.

createAllTestSuite

public junit.framework.TestSuite createAllTestSuite(TestClassParser tcp)
Create a new TestSuite, containing the tests returned by the call to createTests() and createWarningTests.

Returns:
a new TestSuite with all the valid, discovered tests, and the warning tests.

createWarningTest

public static junit.framework.Test createWarningTest(java.lang.String message)
Create a new Test that will fail with the given error message.

Parameters:
message - the text to report in the failure of the created Test.
Returns:
a test that will fail with the given message.

warning

protected void warning(java.lang.String message)
Adds a warning message to the inner list of warnings.

Parameters:
message - the message describing the warning.


Copyright © 2001-2003 by The GroboUtils Project