Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-5137

MockFor.getInstance() fails for abstract classes

    XMLWordPrintableJSON

Details

    Description

      Trying to mock or stub an abstract class fails as of groovy 1.8.2 and later (this
      works under 1.7.10, 1.8.0, and 1.8.1). This code

      import groovy.mock.interceptor.MockFor
      
      MockFor.getInstance(URLConnection, new URL('http://foo'))
      

      results in

      Caught: BUG! exception in phase 'class generation' in source unit 'Script1.groovy' SpreadExpression should not be visited here
      BUG! exception in phase 'class generation' in source unit 'Script1.groovy' SpreadExpression should not be visited here
      

      The breakage was possibly introduced by the fix for GROOVY-4968.

      Also note that this may be related to GROOVY-4255, though I'd expect MockFor and StubFor
      to work irrespective of the status of that bug.

      Attachments

        Activity

          People

            melix Cédric Champeau
            roadrunner Fergal Monaghan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: