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
Post a Comment