Yes, there should be "match" methods that setup stubs for invocations of
void methods.
You can work around this by using matchAndReturn and setting the return
value as null. Note: returning Void.TYPE from a void method will result in
an invocation error because it is a reference to an actual object, and so
not void.
Cheers,
Nat.
_______________________
Dr. Nathaniel Pryce
B13media Ltd.
http://www.b13media.com
+44 (0)7712 526 661
----- Original Message -----
From: "Francois Beausoleil" <fb...@us...>
To: <moc...@li...>
Sent: Wednesday, August 27, 2003 3:20 PM
Subject: [MO-java-dev] Possible match method missing in Mock/OrderedMock
Hi,
There is expect(), expectAndReturn() and expectAndThrow. For the match
methods we have matchAndReturn() and matchAndThrow(). There are no
match() methods. It is possible to simulate this by using
matchAndReturn() and returning Void.TYPE though.
Should the Mock/OrderedMock implementations have simple match() methods ?
Even though the methods return no element, they might be called anyway.
For example, Hibernate has a Session object. In one test, I expect()
that disconnect() will be called. Then, in other tests, I know this
method will be called, so I simply match("disconnect", C.NO_ARGS).
Currently, I need to matchAndReturn("disconnect", C.NO_ARGS, Void.TYPE).
Thanks !
François
Developer of Java Gui Builder
http://jgb.sourceforge.net/
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Mockobjects-java-dev mailing list
Moc...@li...
https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev
|