Unit Testing Java and Groovy Code

Thanks to excellent Java-Groovy integration, we can use any Java-based testing framework and mock-objects framework (such as EasyMock, JMock, and Mockito), with Groovy. We’re not limited to those, however. When we install Groovy, we automatically get a unit-testing framework built on JUnit. We can use it to test any code on the Java Virtual Machine—our Java code, our Groovy code, and so on. We simply extend our test class from GroovyTestCase and implement our test methods, and we’re all set to run our tests.

Get Programming Groovy 2 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.