18.2 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 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.