Written during GR8Conf and published just before my holiday. Now a blogpost was due about a small Groovy library I wrote to make my value objects more “bullet-proof”, aptly called Bulletproof 🙂
It is easy to use the Spock Framework, shipped with Grails, to mock or stub a collaborator (such as a service) in our Grails unit tests.
The Testing chapter explains a bit about mocking collaborators,
doWithConfig callback methods, the
FreshRuntime annotation to mock beans in tests — but they’re mainly for unit testing.
How about mocking beans in an integration test?
Not only has it upgraded its dependencies to Hibernate 5.1.5, Spring Framework 4.3.7, Spring Boot 1.5.3 and Gradle 3.5, but it also finally ships with the latest Spock 1.1 testing framework.
Since Groovy 1.0 we have groupBy and collectEntries to group elements from a Collection together into a Map. I had a little fun with them last week.