groovy
  1. groovy
  2. GROOVY-4729

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

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.7.9
    • Fix Version/s: 1.9-beta-4, 1.8.4, 1.7.11
    • Component/s: mocks and stubs
    • Labels:
      None
    • Environment:
      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
    • Number of attachments :
      0

      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.

        Activity

          People

          • Assignee:
            CÚdric Champeau
            Reporter:
            Travis Hume
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: