my dog learned polymorphism
The moose likes Testing and the fly likes test spy and mock Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "test spy and mock" Watch "test spy and mock" New topic

test spy and mock

David Spades
Ranch Hand

Joined: Feb 01, 2014
Posts: 343

I read that we should not use mocks if a failed assertion cannot be reported effectively back to the Test Runner. This may be the case if the tested object is running inside a container that catches and eats all exceptions. In these cases we may be better off using a Test Spy.

Could anyone please explain about this? I mean can anybody show an example of an object that's running inside a container where mocks would fail and spy won't?
Tim Cooke

Joined: Mar 28, 2008
Posts: 2534

That's quite a broad question. What do you mean by "container"? And what kind of assertion are you talking about?

Tim Driven Development
I agree. Here's the link:
subject: test spy and mock
It's not a secret anymore!