Spock: How to get Mock to return value to avoid NullPointerException or InvalidSpecException
The following guide explains how to use mock in Spock Testing Framework in a proper way to get rid of unnecessary problems like NullPointerExceptions and InvalidSpecException when you try stubbing instead of mocking.