Right way to verify with Mockito

13 views
Skip to first unread message

Artjom.Kalita

unread,
Mar 8, 2011, 5:33:28 AM3/8/11
to mockito
Hello, have some question about Mockito usage. I have a method -
getSomethingAmount() in some class (class A) I want to test. This
getSomethingAmount() method logic depends on Set bSet, which is passed
in constructor on class A initialization. For example if Set bSet
contains of 2 objects with Status.OK, when getSomethingAmount() must
return 2. How can I correctly verify this condition with Mockito ?

P.S. Now I stub 2 B class type objects, put them into bSet and then
assert getSomethingAmount() method result with JUnit assertion - it
works, but it doesn't looks to me like "true" Mockito way.

Krisztian Milesz

unread,
Mar 8, 2011, 5:59:31 AM3/8/11
to moc...@googlegroups.com
Hi,

You don't have to use Mockito in every circumstances. Your case seems pretty simple, what you've described is completely normal. Also, if B is easy to instantiate you don't even have to use mocks.

Just my two cents.

Regards,
Krisztian



--
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.


Reply all
Reply to author
Forward
0 new messages