Grails controller integration testing

I wanted to test a groovy controller using a unit test. We had a render whose arguments needs to be verified. Initially we added a test case which extends ControllerUnitTestCase and tried a lot using the renderArgs that is given by the Unit test case. We were able to find that the redirectArgs were working properly but the renderArgs was returning null.

After a bit of struggle, we found that the render arguments are only available in a spring modelandview class which gets constructed when u call render.

Finally, when we changed to the following code


everything started to work.

Even though it is documented in the grails doc in a completely different section in grails doc. The section on testing seems to be misleading.