| net.sourceforge.groboutils.junit.v1.iftc.InterfaceTestSuite
InterfaceTestSuite | public class InterfaceTestSuite extends TestSuite (Code) | | Allows for tests to be written on interfaces or abstract classes. These
must be run through an InterfaceTestSuite to have the implemented object
be set correctly.
This class extends TestSuite only for the purpose of being a testing
repository. The act of parsing TestCase classes is delegated to
new TestSuite instances. A new instance will be created for each
test method (just as TestSuite does), If a TestCase class
has a constructor which is of the form ( String, ImplFactory ),
then each test method instance will be created
once for each known ImplFactory object; these will be
stored and executed through the ImplFactory class. All other
classes will be added just as TestSuite does (the standard method).
The creation of test instances is delayed until the tests are actually
retrieved via the testAt(), tests(), and
testCount() methods. Therefore, adding new Classes and
ImplFactory instances after the creation time will cause an error, due to
problems with addTest() (they cannot be removed).
Currently, this class is slow: it does not do smart things like cache
results from inspection on the same class object.
author: Matt Albrecht groboclown@users.sourceforge.net version: $Date: 2003/02/10 22:52:20 $ since: March 2, 2002 See Also: InterfaceTestCase See Also: ImplFactory See Also: junit.framework.TestSuite |
Constructor Summary | |
public | InterfaceTestSuite() Constructs a TestSuite from the given class, and sets the initial
set of creators. | public | InterfaceTestSuite(Class theClass) Constructs a TestSuite from the given class, and sets the initial
set of creators. | public | InterfaceTestSuite(Class theClass, ImplFactory f) Constructs a TestSuite from the given class, and sets the initial
set of creators. |
InterfaceTestSuite | public InterfaceTestSuite()(Code) | | Constructs a TestSuite from the given class, and sets the initial
set of creators. Adds all the methods
starting with "test" as test cases to the suite.
|
InterfaceTestSuite | public InterfaceTestSuite(Class theClass)(Code) | | Constructs a TestSuite from the given class, and sets the initial
set of creators. Adds all the methods
starting with "test" as test cases to the suite.
Parameters: theClass - the class under inspection |
InterfaceTestSuite | public InterfaceTestSuite(Class theClass, ImplFactory f)(Code) | | Constructs a TestSuite from the given class, and sets the initial
set of creators. Adds all the methods
starting with "test" as test cases to the suite.
Parameters: theClass - the class under inspection Parameters: f - a factory to add to this suite. |
addFactories | public void addFactories(ImplFactory f)(Code) | | Add an array of new Implementation factories to the suite.
This should only be
called before any tests are extracted from this suite.
Parameters: f - a set of factories to add to this suite. exception: IllegalArgumentException - if f is null, orany element in the list is null exception: IllegalStateException - if the tests have already been generated |
addFactory | public void addFactory(ImplFactory f)(Code) | | Add a new Implementation factory to the suite. This should only be
called before any tests are extracted from this suite. If it is
called after, then an IllegalStateException will be generated.
Parameters: f - a factory to add to this suite. exception: IllegalArgumentException - if f is null exception: IllegalStateException - if the tests have already been generated |
addInterfaceTestSuite | public void addInterfaceTestSuite(InterfaceTestSuite t)(Code) | | Add an InterfaceTestSuite to this suite. If an interface extends
another interface, it should add it's super interface's test suite
through this method. The same goes for any abstract or base class.
Adding the parent suite through this method will cause both suites to
share creators. In fact, the parent suite cannot have any
factories when passed into this method, because they will be ignored.
This allows for the flexibility of determining whether to add a full
test suite, without sharing factories, or not.
Parameters: t - a test to add to the suite. It can be null. |
addTestSuite | public void addTestSuite(Class theClass)(Code) | | Adds all the methods
starting with "test" as test cases to the suite.
Overrides the parent implementation to allow for InterfaceTests.
Parameters: theClass - the class under inspection exception: IllegalArgumentException - if theClass is null exception: IllegalStateException - if the tests have already been generated |
addTests | public void addTests(Test[] t)(Code) | | Add an array of tests to the suite.
Parameters: t - a set of tests to add to this suite. Parameters: IllegalArgumentException - if t is null |
createTestCreator | protected ITestCreator createTestCreator(Vector vf)(Code) | | Create a TestCreator that contains the knowledge of how to properly
parse and generate tests for all types of supported test classes.
Parameters: factories - a vector of ImplFactory instances to load Interfacetest class instances. the new creator. |
loadTestSuite | protected void loadTestSuite(Class testClass, TestClassCreator tcc)(Code) | | Load all the tests and warnings from the class and the creator
type into this instance's suite of tests.
Parameters: testClass - the class being inspected for test instancecreation. Parameters: tcc - the creator type that will be used to create new tests. |
loadTestSuites | protected void loadTestSuites()(Code) | | Load all the tests from the cache of classes and factories.
|
testAt | public Test testAt(int index)(Code) | | |
testCount | public int testCount()(Code) | | |
|
|