{"action":"opened","issue":{"url":"https://api.github.com/repos/grails/grails-core/issues/9140","labels_url":"https://api.github.com/repos/grails/grails-core/issues/9140/labels{/name}","comments_url":"https://api.github.com/repos/grails/grails-core/issues/9140/comments","events_url":"https://api.github.com/repos/grails/grails-core/issues/9140/events","html_url":"https://github.com/grails/grails-core/issues/9140","id":97709993,"number":9140,"title":"Getting GroovyCastException with casting to JSON in unit/integration-testing, when using respond","user":{"login":"anielsen3","id":1768950,"avatar_url":"https://avatars.githubusercontent.com/u/1768950?v=3","gravatar_id":"","url":"https://api.github.com/users/anielsen3","html_url":"https://github.com/anielsen3","followers_url":"https://api.github.com/users/anielsen3/followers","following_url":"https://api.github.com/users/anielsen3/following{/other_user}","gists_url":"https://api.github.com/users/anielsen3/gists{/gist_id}","starred_url":"https://api.github.com/users/anielsen3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anielsen3/subscriptions","organizations_url":"https://api.github.com/users/anielsen3/orgs","repos_url":"https://api.github.com/users/anielsen3/repos","events_url":"https://api.github.com/users/anielsen3/events{/privacy}","received_events_url":"https://api.github.com/users/anielsen3/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-28T13:40:17Z","updated_at":"2015-07-28T13:40:17Z","closed_at":null,"body":"When I use `respond dto` in my controller, it works in production. But in testing it sometimes fails, depending on the order tests are run:\r\n\r\n`org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'respondbug.MyDto@47ed5990' with class 'respondbug.MyDto' to class 'grails.converters.JSON'`\r\n\r\n\r\nI've created a small application that demonstrates the error: https://www.dropbox.com/s/gxe1efbqk54c2qp/respondBug.zip?dl=0\r\n\r\nIf you run `grails test-app unit: MyDtoSpec MyControllerSpec` it gives the error.\r\n\r\nif you run `grails test-app unit: MyControllerSpec MyDtoSpec ` it doesn't.\r\n"}}