Skip to content

Instantly share code, notes, and snippets.

@tunaranch
Created December 23, 2013 04:50
Show Gist options
  • Save tunaranch/8091765 to your computer and use it in GitHub Desktop.
Save tunaranch/8091765 to your computer and use it in GitHub Desktop.
Spock seems to bomb out when there's a delegate that contains a field that's Dependency-Injected. Any ideas for a work around? Grails 2.2.3/Spock 0.7
package delegatetest
import grails.plugin.spock.IntegrationSpec
class FooSpec extends IntegrationSpec {
@Delegate FooTestSupport fooTestSupport = new FooTestSupport()
def "test foo"() {
expect:
true
}
}
class FooTestSupport {
def sessionFactory
}
Property 'sessionFactory' threw exception; nested exception is java.lang.NullPointerException
org.springframework.beans.MethodInvocationException: Property 'sessionFactory' threw exception; nested exception is java.lang.NullPointerException
at grails.plugin.spock.IntegrationSpec.setupSpec(IntegrationSpec.groovy:47)
Caused by: java.lang.NullPointerException
... 1 more
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment