Groovy has excellent support for Unit Testing with JUnit 3.8.2 and Mocking built right in.
Currently, special support doesn't exist for JUnit 4 but its easy to use so long as you
are using Groovy 1.1 (currently only available as a SNAPSHOT). Here is an example.
Make sure you are using Groovy 1.1 and JUnit 4.x.
Suppose we want to test the following program:
Here is what your code might look like. This example uses parameterization.
The output will look something like this:
Labels