Test Automation
Groovy Mocking with Spock: Mock, Stub, and Spy Patterns
Spock's built-in mocking eliminates the need for Mockito or PowerMock in most Groovy/Java projects. The API is concise, the error messages are clear, and the interactions integrate directly with the then block's assertion syntax. The Three Types Spock provides three mock variants with distinct purposes: