Posted by on Dec 30, 2011 in Programming | 0 comments

I’ve been fighting with Grails 2.0 over the holidays in order to put together a plan to migrate at least one of our Grails systems from 1.3.7 to 2.0. I’ve made some headway in sorting out some of the expected problems like controller methods now being publicly callable as well as labelling some classes that should have been abstract but couldn’t be because Grails wasn’t able to work with them in earlier versions.

I can get the application up and running on Grails 2.0 but the tests are a different story. It appears they tried to maintain backwards compatibility with the way tests worked in 1.3.7 but it isn’t always the case. The error below was kicking my ass until I tracked it down to the mockLogging implementation.

To reproduce I created a new project with one domain class called Truck. If I leave the mockLogging in place I get the above exception.

If I remove the mockLogging it solves a few hundred of my test failures. From what I’ve read mockLogging is no longer needed in Grails 2.0 regardless if your tests are using the new Mixins or the old GrailsUnitTestCase.

Next stop, trying to figure out why mixed in classes only exist for the first test and disappear for subsequent tests…