We have the following model:
Furthermore, the following test is in place:
What you see here is that an instance of type A is created, and that its field 'b' is null. This is proven by the assert statements in the testIsNull method, where the record is fetched and checked for a null value in field 'b'.
Now the named query 'withoutB' is called, which must return all objects where 'b' is null. Note that this named query is defined in the body of class A.
The result now is that no results are returned, instead of the expected 1 record.
If isNull('b' is changed to isNotNull('b'), 1 result is returned.
Remarkable is that isNull seems to work fine when the application is run under the full Grails context.
It has all appearances that isNull in a test context has a different implementation from the real context and that the test context implementation has a bug.