You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Validators are not executed in unit test (String-based queries like [executeQuery] are currently not supported in this implementation of GORM) #10200
After upgrading to Grails 3.2 I found a problem with a unit test that uses in memory database support.
When I use the annotation TestFor the specified domain field validation are working as expected but the String-based queries are not supported.
java.lang.UnsupportedOperationException: String-based queries like [executeQuery] are currently not supported in this implementation of GORM. Use criteria instead.
at org.grails.datastore.gorm.GormStaticApi.unsupported(GormStaticApi.groovy:1124)
at org.grails.datastore.gorm.GormStaticApi.executeQuery(GormStaticApi.groovy:1028)
at org.grails.datastore.gorm.GormStaticApi.executeQuery(GormStaticApi.groovy:1024)
at org.grails.datastore.gorm.GormEntity$Trait$Helper.executeQuery(GormEntity.groovy:1030)
at grails.issues.Season.between(Season.groovy:64)
at grails.issues.SeasonSpec.Find all season between #aDate and #bDate(SeasonSpec.groovy:49)
If I remove the TestFor annotation the behaviour changes the other way around. Validation does not work but the String-based queries are supported.
Task List
Steps to reproduce provided
Stacktrace (if present) provided
Example that reproduces the problem uploaded to Github
Full description of the issue provided (see below)
This test works as expected since it uses the TestFor annotation
Expected Behaviour
The validator should be called in a unit test in any case. With or without the using the TestFor annotation. executeQuery operations should be supported.
Actual Behaviour
If I remove the TestFor annotation the validator does not get called but executeString operations are supported.
changed the title [-]Validators are not executed in unit test[/-][+]Validators are not executed in unit test (String-based queries like [executeQuery] are currently not supported in this implementation of GORM)[/+]on Oct 4, 2016
Activity
[-]Validators are not executed in unit test[/-][+]Validators are not executed in unit test (String-based queries like [executeQuery] are currently not supported in this implementation of GORM)[/+]Test for apache/grails-core#10200
saw303 commentedon Oct 19, 2016
This one does not seems to be fixed in Grails 3.2.1. The following test still fails if you use
@TestFor.Can someone reopen this issue?
Test for apache/grails-core#10200