|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.framework.TestSuite
net.sourceforge.groboutils.junit.v1.iftc.InterfaceTestSuite
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.
InterfaceTestCase
,
ImplFactory
,
TestSuite
Constructor Summary | |
InterfaceTestSuite()
Constructs a TestSuite from the given class, and sets the initial set of creators. |
|
InterfaceTestSuite(java.lang.Class theClass)
Constructs a TestSuite from the given class, and sets the initial set of creators. |
|
InterfaceTestSuite(java.lang.Class theClass,
ImplFactory f)
Constructs a TestSuite from the given class, and sets the initial set of creators. |
Method Summary | |
void |
addFactories(ImplFactory[] f)
Add an array of new Implementation factories to the suite. |
void |
addFactory(ImplFactory f)
Add a new Implementation factory to the suite. |
void |
addInterfaceTestSuite(InterfaceTestSuite t)
Add an InterfaceTestSuite to this suite. |
void |
addTests(junit.framework.Test[] t)
Add an array of tests to the suite. |
void |
addTestSuite(java.lang.Class theClass)
Adds all the methods starting with "test" as test cases to the suite. |
protected ITestCreator |
createTestCreator(java.util.Vector vf)
Create a TestCreator that contains the knowledge of how to properly parse and generate tests for all types of supported test classes. |
protected void |
loadTestSuite(java.lang.Class testClass,
TestClassCreator tcc)
Load all the tests and warnings from the class and the creator type into this instance's suite of tests. |
protected void |
loadTestSuites()
Load all the tests from the cache of classes and factories. |
junit.framework.Test |
testAt(int index)
|
int |
testCount()
|
java.util.Enumeration |
tests()
|
Methods inherited from class junit.framework.TestSuite |
addTest, countTestCases, createTest, getName, getTestConstructor, run, runTest, setName, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public InterfaceTestSuite()
public InterfaceTestSuite(java.lang.Class theClass)
theClass
- the class under inspectionpublic InterfaceTestSuite(java.lang.Class theClass, ImplFactory f)
theClass
- the class under inspectionf
- a factory to add to this suite.Method Detail |
public void addFactory(ImplFactory f)
f
- a factory to add to this suite.
java.lang.IllegalArgumentException
- if f is null
java.lang.IllegalStateException
- if the tests have already been generatedpublic void addFactories(ImplFactory[] f)
f
- a set of factories to add to this suite.
java.lang.IllegalArgumentException
- if f is null, or
any element in the list is null
java.lang.IllegalStateException
- if the tests have already been generatedpublic void addInterfaceTestSuite(InterfaceTestSuite t)
This allows for the flexibility of determining whether to add a full test suite, without sharing factories, or not.
t
- a test to add to the suite. It can be null.public void addTests(junit.framework.Test[] t)
t
- a set of tests to add to this suite.public void addTestSuite(java.lang.Class theClass)
Overrides the parent implementation to allow for InterfaceTests.
theClass
- the class under inspection
java.lang.IllegalArgumentException
- if theClass is null
java.lang.IllegalStateException
- if the tests have already been generatedpublic junit.framework.Test testAt(int index)
public int testCount()
public java.util.Enumeration tests()
protected void loadTestSuites()
protected void loadTestSuite(java.lang.Class testClass, TestClassCreator tcc)
testClass
- the class being inspected for test instance
creation.tcc
- the creator type that will be used to create new tests.protected ITestCreator createTestCreator(java.util.Vector vf)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |