concept rest in category groovy

appears as: rest, The rest, REST
Groovy in Action, Second Edition

This is an excerpt from Manning's book Groovy in Action, Second Edition.

If you’ve worked with Java 1.4 or later, you’re probably familiar with assertions. They test whether everything is right with the world as far as your program is concerned. Usually they live in your code to make sure you don’t have any inconsistencies in your logic, for performing tasks such as checking preconditions at the beginning and postconditions and invariants at the end of a method, or for ensuring that method arguments are valid. In this book we’ll use them to demonstrate the features of Groovy. Just as in test-driven development, where the tests are regarded as the ultimate demonstration of what a unit of code should do, the assertions in this book demonstrate the results of executing particular pieces of Groovy code. We use assertions to show not only what code can be run, but the result of running the code. This section will prepare you for reading the code examples in the rest of the book, explaining how assertions work in Groovy and how you’ll use them.

The solution in listing 18.13 is arguably the simplest one that we can get, and it’s so close to optimal that if you’re a practitioner, you may want to skip the rest of this section and go right to the summary. The concurrency-addicted developer may want to read on. We have interesting variants coming!