March 2016
Intermediate to advanced
304 pages
8h 9m
English
In this section you’ll see how to create partial mocks.[8] Chapter 6 explained how Spock can create fake objects that are useful for testing and showed you mocks and stubs. Spock supports a third type of “fake” object: spies.
And why you shouldn’t use them!
Spies, shown in figure 8.5, work as partial mocks. They take over a Java object and mock only some of its methods. Method calls can either by stubbed (like mocks) or can pass through to the real object.

I purposely didn’t show you spies in ...
Read now
Unlock full access