| java.lang.Object net.sourceforge.groboutils.junit.v1.parser.TestClassParser
TestClassParser | public class TestClassParser (Code) | | Parses Test classes to discover the usable test methods.
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.
author: Matt Albrecht groboclown@users.sourceforge.net version: $Date: 2002/11/05 00:49:31 $ since: March 28, 2002 |
Constructor Summary | |
public | TestClassParser(Class theClass) The primary constructor, which will cause this instance to know how to
parse only the passed-in class. |
Method Summary | |
protected void | addTestMethod(Method m, Vector names) Adds the method m to the inner list of known test methods,
but only if it is a public test method. | public void | clearWarnings() Remove all current warnings. | protected void | discoverTestMethods(Class theClass) Discover and record the test methods of the public test class
theClass. | public String | getName() Get the name of the test suite. | public Class | getTestClass() Get the class under test. | public Method[] | getTestMethods() Retrieve all public test methods discovered through inspection. | public String[] | getWarnings() Retrieve all warnings generated during the introspection of the class,
or test creation. | protected boolean | isPublicTestMethod(Method m) Asserts that the method is public, and that it is also a test method.
Parameters: m - the method under scrutiny. | protected boolean | isTestMethod(Method m) Test if method m is a test method, which means it accepts
no parameters, returns void, and the name of the method
begins with test.
Parameters: m - the method under scrutiny. | protected boolean | testClass(Class theClass) Discover if the given class is a valid testing class.
Parameters: theClass - the class to parse for testing. | protected void | warning(String message) Adds a warning message to the inner list of warnings. |
TestClassParser | public TestClassParser(Class theClass)(Code) | | The primary constructor, which will cause this instance to know how to
parse only the passed-in class.
Parameters: theClass - the class to parse for testing. exception: IllegalArgumentException - if theClass isnull. |
addTestMethod | protected void addTestMethod(Method m, Vector names)(Code) | | Adds the method m to the inner list of known test methods,
but only if it is a public test method.
Parameters: m - the method to add. Parameters: names - a list of method names that have already been inspected. |
clearWarnings | public void clearWarnings()(Code) | | Remove all current warnings.
|
discoverTestMethods | protected void discoverTestMethods(Class theClass)(Code) | | Discover and record the test methods of the public test class
theClass.
Parameters: theClass - the class to parse for testing. |
getName | public String getName()(Code) | | Get the name of the test suite. By default, this is the class name.
the name of the test suite. |
getTestClass | public Class getTestClass()(Code) | | Get the class under test. This will never return null, and
will always match the class passed into the constructor.
the class under test. |
getTestMethods | public Method[] getTestMethods()(Code) | | Retrieve all public test methods discovered through inspection.
all test methods. |
getWarnings | public String[] getWarnings()(Code) | | 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.
an array of all warnings generated while creating the testarray. |
isPublicTestMethod | protected boolean isPublicTestMethod(Method m)(Code) | | Asserts that the method is public, and that it is also a test method.
Parameters: m - the method under scrutiny. true if m is a public test method, otherwisefalse. See Also: TestClassParser.isTestMethod(Method) |
isTestMethod | protected boolean isTestMethod(Method m)(Code) | | Test if method m is a test method, which means it accepts
no parameters, returns void, and the name of the method
begins with test.
Parameters: m - the method under scrutiny. true if m is a public test method, otherwisefalse. |
testClass | protected boolean testClass(Class theClass)(Code) | | Discover if the given class is a valid testing class.
Parameters: theClass - the class to parse for testing. true if the class is a public test class, otherwisefalse. |
warning | protected void warning(String message)(Code) | | Adds a warning message to the inner list of warnings.
Parameters: message - the message describing the warning. |
|
|