net.sf.saffron.util
Class MethodCallTestCase
java.lang.Object
|
+--junit.framework.Assert
|
+--junit.framework.TestCase
|
+--net.sf.saffron.util.MethodCallTestCase
- All Implemented Interfaces:
- Test
- public class MethodCallTestCase
- extends TestCase
A MethodCallTestCase
is a TestCase
which invokes a
method on an object. You can use this class to expose methods of a
non-TestCase class as unit tests; addTestMethods(junit.framework.TestSuite, java.lang.Object, net.sf.saffron.util.MethodCallTestCase.Dispatcher)
does this for
all public
, non-static
, void
methods whose names start with "test", and have one .
- Since:
- Mar 19, 2003
- Version:
- $Id: //open/saffron/src/net/sf/saffron/util/MethodCallTestCase.java#2 $
- Author:
- jhyde
Nested Class Summary |
static interface |
MethodCallTestCase.Dispatcher
A class implementing Dispatcher calls a method from within
its own security context. |
Fields inherited from class junit.framework.TestCase |
|
Methods inherited from class junit.framework.Assert |
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail |
dispatcher
private final MethodCallTestCase.Dispatcher dispatcher
method
private final Method method
o
private final Object o
args
private final Object[] args
MethodCallTestCase
MethodCallTestCase(String name,
Object o,
Method method,
MethodCallTestCase.Dispatcher dispatcher)
isSuitable
public static boolean isSuitable(Method method)
- Returns whether a method can be called as a test case; it must:
-
be
public
-
be non-
static
-
return
void
-
begin with
test
-
have precisely one parameter of type
TestCase
(or a class
derived from it)
addTestMethods
public static void addTestMethods(TestSuite suite,
Object o,
MethodCallTestCase.Dispatcher dispatcher)
runTest
protected void runTest()
throws Throwable
- Overrides:
runTest
in class TestCase
Throwable