|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.javaforge.tapestry.testng.Capturer<T>
T - the type of object to capturepublic final class Capturer<T>
An EasyMock 2.0 argument matcher that captures a method argument value. This allows an object created inside a test method to be interrogated after the method completes, even when the object is not a return value, but is merely passed as a parameter to a mock object.
| Constructor Summary | |
|---|---|
Capturer(java.lang.Class<T> matchType)
Creates a new Capturer for the given type. |
|
| Method Summary | ||
|---|---|---|
void |
appendTo(java.lang.StringBuffer buffer)
|
|
static
|
capture(Capturer<T> capturer)
Useage (with static imports): |
|
T |
getCaptured()
Returns the method argument value previously captured. |
|
boolean |
matches(java.lang.Object parameter)
|
|
static
|
newCapturer(java.lang.Class<T> matchType)
Factory method that invokes the normal constructor in a way that keeps Java Generics happy. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Capturer(java.lang.Class<T> matchType)
| Method Detail |
|---|
public static <T> Capturer<T> newCapturer(java.lang.Class<T> matchType)
public void appendTo(java.lang.StringBuffer buffer)
appendTo in interface org.easymock.IArgumentMatcherpublic boolean matches(java.lang.Object parameter)
matches in interface org.easymock.IArgumentMatcherpublic T getCaptured()
public static <T> T capture(Capturer<T> capturer)
Capturer<Type> c = newCapturer(Type.class);
mock.someMethod(capture(c));
. . .
c.getCaptured().getXXX()
The interrogation of the captured argument should occur after the test subject has invoked
the method on the mock; the best time for this is typically after invoking
TestBase.verify().
Remember that when you use an argument matcher for one argument of a method invocation, you must use argument matchers for all arguments of the method invocation.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||