Closed GoogleCodeExporter closed 9 years ago
Hi,
Not really right now, though this is an interesting idea; "an answer toolkit".
Original comment by brice.du...@gmail.com
on 12 Dec 2011 at 9:28
I have coded something that might help here. It is basically a class in the
fashion of Answers.class, except that it is dedicated to returning one of the
parameters.
http://code.google.com/r/ericlef-mockito/source/detail?r=2a33398421f4abc42aa5760
b44ab3881823ac96b
For example, IdentityAnswers.RETURN_FIRST_PARAMETER returns an Answer that can
return the first parameter passed to the method we are stubbing.
Answers provided are :
RETURN_FIRST_PARAMETER
RETURN_SECOND_PARAMETER
RETURN_LAST_PARAMETER
RETURN_PARAMETER
Original comment by eric...@gmail.com
on 7 Mar 2012 at 9:38
Personally, I'm that keen on the EasyAnswer abstract class.
I see little benefit of:
arg(0) vs invocation.getArguments()[0]
If I want to solve the use case, I'd rather add a arg(x) method on the
invocation, so that you can do:
invocation.arg(0)
Adding new object to the public API that is not an interface (it's a class -
albeit abstract) deserves a better use case I think :)
Regarding the return_x_parameter stuff. We can have it so long it does not
clutter the 1st level API, that is the Mockito class. We've already found a
place for such custom answers somewhere just don't remember where :)
Original comment by szcze...@gmail.com
on 8 Mar 2012 at 2:52
Original comment by brice.du...@gmail.com
on 9 Mar 2012 at 11:03
Issue 281 has been merged into this issue.
Original comment by brice.du...@gmail.com
on 9 Mar 2012 at 11:48
Original comment by brice.du...@gmail.com
on 4 Jul 2012 at 1:00
Original issue reported on code.google.com by
brianfromoregon
on 11 Dec 2011 at 1:06