Writing Tests with Spock

Learn about the Spock testing framework by creating a project that uses Spock to unit test Java code

Mocks
Mocks
Mocks are a useful testing tool. We can provide "empty" objects, so we don't have to initialise the whole application to test a section, and we can use mocks to check our code is making the calls we expect.
Stubs
Stubs
Stub objects allow us to state from a test what values get injected into our application code. They can provide simple interfaces, so we don't have to initialise the whole application to test a section.