Java Mailing List Archive

http://www.gg3721.com/

Home » user.jmock »

[jmock-user] calls to equals() of mocked interfaces

Konrad Hosemann

2008-04-09

Replies: Find Java Web Hosting

Author LoginPost Reply
Hi,

could someone explain the following behaviour using JMock 2.4.0 and JUnit 4.4:

interface Dummy {  
}

public class EqualsTest {
 
 @Test
 public void testEquals() {
   Mockery context = new JUnit4Mockery();
   final Dummy dummy = context.mock(Dummy.class);
   final Object o = new Object();
   
   context.checking(new Expectations() {{
     one(dummy).equals(o); will(returnValue(true));
   }});
   
   assertTrue(dummy.equals(o));
 }
}

The test fails. It seems that the call to equals is not handled by the proxy but
by java.lang.Object. I only found an old issue #55 regarding JMock1 which was
fixed long time ago.

Any comments?

best regards,
konrad


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


©2008 gg3721.com - Jax Systems, LLC, U.S.A.