4

Take a look at this picture. what is going on with Mockito verifying Argument ?

I want to verify that view is invoked with the argument factory.

 @Test
  public void shouldInitializeTheDriverWithTheRequestFactory() {

    CVProxy proxy = context.create(CVProxy.class);

    workflow.initialize();

    verify(view).initializeWithRequestFactory(factory);

    verify(view).editWithEditor(proxy, context);

  }

However I got this error which is weird ?!

Argument(s) are different! Wanted:
view.initializeWithRequestFactory(
    com.google.web.bindery.requestfactory.vm.InProcessRequestFactory@13c6a22
);
-> at CreatingNewCVWorkflowTest.shouldInitializeTheDriverWithTheRequestFactory(CreatingNewCVWorkflowTest.java:53)
Actual invocation has different arguments:
view.initializeWithRequestFactory(
    com.google.web.bindery.requestfactory.vm.InProcessRequestFactory@13c6a22
);

as you can the arguments are IDENTICAL. enter image description here

Adelin
  • 18,144
  • 26
  • 115
  • 175

1 Answers1

5

Is it possible that the factory instance has an incorrectly implemented equals method (so that the equals method reports that the object is not equal to itself)?

codebox
  • 19,927
  • 9
  • 63
  • 81
  • I was thinking the same thing. – jhericks Jul 12 '12 at 16:07
  • Neither it nor its superclasses--[`AbstractRequestFactory`](http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/web/bindery/requestfactory/shared/impl/AbstractRequestFactory.java) and [`IdFactory`](http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/web/bindery/requestfactory/shared/impl/IdFactory.java)--implement `equals`. – David Harkness Jul 26 '12 at 15:39