Grails unit testing and bootstrap
- by tbruyelle
I wrote an unit test for a controller.
I have a Bootstrap file which alter the metaclass of domain classes by adding a method asPublicMap(). I use this method in the controller to return domain classes as json but only some selected public fields.
My unit test failed because of MissingMethodException for asPublicMap(). As I understood, bootstrap classes are not loaded for unit tests, only for integration tests. That's why I got this error.
My question is : Is there another place to put metaclass manipulation in order to take them into account during unit tests ?