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

MockFor and StubFor call unsupported method in ProxyGenerator for creation of instances of Abstract classes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.7-beta-1
    • 1.6.5, 1.7-beta-2
    • None
    • None
    • Windows XP Professional Version 5.1.2600 Service Pack 2 Build 2600

    Description

      public abstract class MyNode {

      }

      @Test
      public void testCreateStubNode()

      { def stubNodeContext = new StubFor(MyNode) assertNotNull(stubNodeContext.proxyInstance()) }

      @Test
      public void testCreateStubNodeDelegate()

      { def stubNodeContext = new StubFor(MyNode) assertNotNull(stubNodeContext.proxyDelegateInstance()) }

      @Test
      public void testCreateMockNode()

      { def mockNodeContext = new MockFor(MyNode) assertNotNull(mockNodeContext.proxyInstance()) }

      @Test
      public void testCreateMockNodeDelegate()

      { def mockNodeContext = new MockFor(MyNode) assertNotNull(mockNodeContext.proxyDelegateInstance()) }

      In any case (and with a non-empty Abstract class such as import javax.media.j3d.Node) the result is:

      groovy.lang.MissingMethodException: No signature of method: groovy.util.ProxyGenerator.instantiateAggregateFromBaseClass() is applicable for argument types: (java.lang.Class, null) values: [class MyNode, null]

      Which appears to be absolutely true: the ProxyGenerator only has these 3 method signatures, none of which have the Class as the 1st argument (save the single parameter version)...

      instantiateAggregateFromBaseClass(Class)
      instantiateAggregateFromBaseClass(Map, Class)
      instantiateAggregateFromBaseClass(Closure, Class)

      Attachments

        Activity

          People

            roshandawrani Roshan Dawrani
            geoffsindel Geoff Sindel
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: