I'm unit testing a controller and currently I'm stuck with the method-call of "encodeAsJSON()" in a service (called by the controller).
I get the MissingMethodException, which I would expect as encodeAsJSON() is a Grails-Codec.
After a bit of searching the loadCodec
-Method should do what I want.
But I can't import it, because my IDE (SpringSource-ToolSuite) can't find it.
Error:
import org.codehaus.groovy.grails.plugins.codecs.JSONCodec
Everything works:
import org.codehaus.groovy.grails.plugins.codecs.HTMLCodec
But I don't need the HTMLCodec and the documentation doesn't list the JSONCodec.
The method itself is still working (running the application), but I don't know how to unit test it. Any ideas? Am I missing something obvious?