It is a very cool idea. What if the inputs are less 'modelled', like
Strings for example?
Cheers,
Szczepan
> --
> You received this message because you are subscribed to the Google Groups "mockito" group.
> To post to this group, send email to moc...@googlegroups.com.
> To unsubscribe from this group, send email to mockito+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mockito?hl=en.
>
>
Exactly.
Another question is what to do you do when request to collaborator needs formal parameters.
Good stuff
Szczepan
Sounds good. Guys, don't hesitate to share thoughts on testing experience with this feature.
Cheers!
Szczepan
You are happily claiming that "Mockito's when idiom is an implicit and
unwanted verification of an interaction with a collaborator"
This problem could easily be mitigated by replacing:
when(personDao.getPerson("123-45-6789")).thenReturn(zeus);
with
when((Person)any()).thenReturn(zeus);
If you really care about the right parameter value being passed in you
can use an *additional* verify.
Also you claim to be not interested in the interaction with the
personDao. This seems quite arbitrary as interacting with the DAO is
half of what the method does. If you don't care about the interaction
you probably don't care that much about the whole method. I concede
that this is only an example method, but if this what real code I
wouldn't write a unit test for a two-line ;-).
From the example I don't see the advantage over Mockito.
Cheers,
Felix
It is a very cool idea. What if the inputs are less 'modelled', like
Strings for example?
True enough. :)
I guess I would mostly take advantage of this new idea when:
-I don't care about the parameters and I don't care about the method name
-or specifying the method name & params in somewhat a hindrance.
>or even maybe show steps in TDD process
Yeah, interesting. If I specify a method name & params in the test I
can drive the implementation slightly easier. OTOH I can drive it as
well from the code xD.
Cheers,
Szczepan