I am very interested in using the software in my test dreiven development.
I am still learning, using David Astel's book on the subject.
My problem is when I try to specified an object, like an ArrayList, as the expected parameter of a method.
The parameter passed to the mock will never be the same as the expected. How can I make this?
If you want I can send you a little demo problem where you can see what I say
Thank you very much
Juan M. Cervera
I have the same problem.
The only workaround I found is to use the SetDefault... instead of SetVoidCallable, SetReturnValue.
I guess the expected behavior is to check that the objects passed as method parameters are equivalent and not the same instance.
Absolutely - it's all a case of providing an appropriate matcher, basically.
One thing I'm currently considering is whether it would be useful to have a matcher which (when in "record" mode) treated null as "something may be passed as this parameter, but don't worry about what it is" which would allow the checking of some parameters but not others. It shouldn't be too hard to write, and could be quite useful.
Log in to post a comment.