saffron.util
Class MethodCallTestCase
java.lang.Object
|
+--junit.framework.Assert
|
+--junit.framework.TestCase
|
+--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, 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/main/saffron/util/MethodCallTestCase.java#1 $
- 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 |
o
private final Object o
args
private final Object[] args
method
private final Method method
dispatcher
private final MethodCallTestCase.Dispatcher dispatcher
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)
runTest
protected void runTest()
throws Throwable
- Overrides:
runTest
in class TestCase
Throwable
addTestMethods
public static void addTestMethods(TestSuite suite,
Object o,
MethodCallTestCase.Dispatcher dispatcher)