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

Object.toString() called instead of coerced Map toString closure

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7.9
    • 1.9-beta-4, 1.8.4, 1.7.11
    • mocks and stubs
    • None
    • Ubuntu linux 10.10 x86_64

      java version "1.6.0_21"
      Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
      Java HotSpot(TM) 64-Bit Server VM (build 17.0-b16, mixed mode)

      Groovy Version: 1.7.9 JVM: 1.6.0_21

    Description

      Sorry to open a new issue, this is very similar to http://jira.codehaus.org/browse/GROOVY-2801

      In this instance, I'm mocking the toString method on an Abstract class SocketAddress.

      channel = [
      getRemoteAddress:

      { [toString: remoteAddress] as SocketAddress }

      ,
      getLocalAddress:

      { [toString: localAddress] as SocketAddress }

      ] as Channel

      and during the test, I receive a failure:

      org.junit.ComparisonFailure: expected:<[10.10.2.20]> but was:<[SocketAddress_groovyProxy@5a425eb9]>
      at org.junit.Assert.assertEquals(Assert.java:123)
      at org.junit.Assert.assertEquals(Assert.java:145)
      at org.junit.Assert$assertEquals.callStatic(Unknown Source)
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:48)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:165)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:177)

      GROOVY-2801 was closed some time ago so I'm opening this new issue.

      Attachments

        Activity

          People

            melix Cédric Champeau
            travishume Travis Hume
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: