Created
          December 23, 2013 04:50 
        
      - 
      
 - 
        
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
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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 | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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