Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
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 :
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:
,
getLocalAddress:
] 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.
Worked around by creating another class
channel = [
{ new MockSocketAddress(address: remoteAddress) }getRemoteAddress:
,
{ new MockSocketAddress(address: localAddress) }getLocalAddress:
] as Channel
...
class MockSocketAddress extends SocketAddress {
def address
public String toString()
{ address }}