Java Reference
In-Depth Information
Listing 10.6. A unit test for the groovlet using GroovyShell and Binding
The interesting parts of this test are first that the groovlet expects a map of input paramet-
ers, so the test has to provide one, and that I need a way to capture the output stream from
the groovlet, which is done through the out variable of the binding.
Recall from chapter 6 that Groovy also provides a subclass of GroovyTestCase , called
GroovyShellTestCase , which is designed to test scripts like this. The following list-
ing shows the same unit test using GroovyShellTestCase . Note that it's noticeably
simpler.
Search WWH ::




Custom Search