Grails - Unit test controller that's using a named marshaller -


i'm trying unit test controller that's using named marshaller. controller looks this:

def userbyemail(userbyemailcommand userbyemailcommand) {     render checkforerrorsandexecute(userbyemailcommand) { userbyemailcommand cmd ->         json.use("complete") {             [users: [userservice.getuserbyprimaryemailaddress(cmd.email)]] json         }     } } 

when run test i'm getting exception saying converter configuration name 'complete' not found!.

any on appreciated. thanks.

you can create named config in test itself. example:

given: 'register marshaller' json.createnamedconfig('complete') {      it.registerobjectmarshaller(map) { map item -> item } }  when: 'controller action called' controller.userbyemail()  then: // assertion goes here 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -