2.5. Advanced Groovy features useful to testing

I hope that this chapter serves as a gentle introduction to Groovy, and that if you were scared by the syntax of Spock tests in chapter 1, you’re now more confident about how things work. In several ways, Groovy simplifies Java code by leaving only the gist and discarding the bloat.

Explaining all the things Groovy can do in a single chapter is impossible. Groovy has several advanced constructs for core programming that blow away any Java code you’ve already seen. This last section presents some advanced concepts that you might use in your Spock tests.

Don’t be alarmed if the code shown is more complex than the previous examples. You can skip this part and come back again when you have more experience ...

Get Java Testing with Spock now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.