On Mon, Dec 19, 2011 at 5:20 PM, Luke Daley <lda...@gmail.com> wrote:
Is it Grails that normally adds mockDomain(Class), mockDomain(Class, List)
to classes under test? I would have liked looking at that transform, etc to
see if it is adding a method with return type not void, but Object.
There shouldn't be any transforms kicking in. I can't think of what would
be unique about your project, because this definitely works for others.
See if you can reproduce in a small isolated project and share it, if I
can poke at it it might make the process quicker.
I poked around a bit. The mockDomain() methods are added to ClientSpec
by GrailsASTUtils.addDelegateInstanceMethods(...) -
Regarding Groovy's verifier rejecting the ClientSpec with "*The return type
of java.lang.Object mockDomain(java.lang.Class) in foo.Spec is incompatible
with void mockDomain(java.lang.Class) in grails.plugin.spock.UnitSpec*" ->
- the reason is that we also use Groovy++ in our Grails application
and there is an additional Verifier visit Groovy++ performs for its own
thing. That early Verifier visit is resulting in this issue. So, it's an
issue with Grails 2.0 / Groovy 1.8.4 + Groovy++ marriage. That's why you
don't commonly see this issue elsewhere. Not a Grails issue, but something
between Groovy++ and Groovy 1.8.4. Will ask around more there.