{"action":"opened","issue":{"url":"https://api.github.com/repos/grails/grails-core/issues/10200","repository_url":"https://api.github.com/repos/grails/grails-core","labels_url":"https://api.github.com/repos/grails/grails-core/issues/10200/labels{/name}","comments_url":"https://api.github.com/repos/grails/grails-core/issues/10200/comments","events_url":"https://api.github.com/repos/grails/grails-core/issues/10200/events","html_url":"https://github.com/grails/grails-core/issues/10200","id":180818627,"number":10200,"title":"Validators are not executed in unit test","user":{"login":"saw303","id":71073,"avatar_url":"https://avatars.githubusercontent.com/u/71073?v=3","gravatar_id":"","url":"https://api.github.com/users/saw303","html_url":"https://github.com/saw303","followers_url":"https://api.github.com/users/saw303/followers","following_url":"https://api.github.com/users/saw303/following{/other_user}","gists_url":"https://api.github.com/users/saw303/gists{/gist_id}","starred_url":"https://api.github.com/users/saw303/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saw303/subscriptions","organizations_url":"https://api.github.com/users/saw303/orgs","repos_url":"https://api.github.com/users/saw303/repos","events_url":"https://api.github.com/users/saw303/events{/privacy}","received_events_url":"https://api.github.com/users/saw303/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-04T06:59:08Z","updated_at":"2016-10-04T06:59:08Z","closed_at":null,"body":"After upgrading to Grails 3.2 [](https://github.com/saw303/grails-issues) I found a problem with a unit test that uses in memory database support.\r\n\r\nWhen I use the annotation `TestFor` the specified domain field validation are working as expected but the String-based queries are not supported.\r\n\r\n```\r\njava.lang.UnsupportedOperationException: String-based queries like [executeQuery] are currently not supported in this implementation of GORM. Use criteria instead.\r\n\r\n    at org.grails.datastore.gorm.GormStaticApi.unsupported(GormStaticApi.groovy:1124)\r\n    at org.grails.datastore.gorm.GormStaticApi.executeQuery(GormStaticApi.groovy:1028)\r\n    at org.grails.datastore.gorm.GormStaticApi.executeQuery(GormStaticApi.groovy:1024)\r\n    at org.grails.datastore.gorm.GormEntity$Trait$Helper.executeQuery(GormEntity.groovy:1030)\r\n    at grails.issues.Season.between(Season.groovy:64)\r\n    at grails.issues.SeasonSpec.Find all season between #aDate and #bDate(SeasonSpec.groovy:49)\r\n```` \r\n\r\nIf I remove the `TestFor` annotation the behaviour changes the other way around. Validation does not work but the String-based queries are supported.\r\n\r\n### Task List\r\n\r\n- [x] Steps to reproduce provided\r\n- [x] Stacktrace (if present) provided\r\n- [x] Example that reproduces the problem uploaded to Github\r\n- [x] Full description of the issue provided (see below)\r\n\r\n### Steps to Reproduce\r\n\r\n1. Check out [example](https://github.com/saw303/grails-issues)\r\n2. Run this [test](https://github.com/saw303/grails-issues/blob/master/src/test/groovy/grails/issues/SeasonWithoutTestForSpec.groovy#L24)\r\n3. This [test](https://github.com/saw303/grails-issues/blob/master/src/test/groovy/grails/issues/SeasonSpec.groovy#L26) works as expected since it uses the `TestFor` annotation\r\n\r\n### Expected Behaviour\r\n\r\nThe validator should be called in a unit test in any case. With or without the using the `TestFor` annotation. executeQuery operations should be supported.\r\n\r\n### Actual Behaviour\r\n\r\nIf I remove the `TestFor` annotation the validator does not get called but executeString operations are supported.\r\n\r\n### Environment Information\r\n\r\n- **Operating System**: OSX 10.11.6\r\n- **Grails Version:** 3.2\r\n- **JDK Version:** 1.8.0_102\r\n\r\n### Example Application\r\n\r\n- [Example](https://github.com/saw303/grails-issues) application\r\n\r\n"}}
{"actor":{"display_login":"saw303"}}