Re: [HAPI-devel] Mock ConnectionHub.attach() with Mockito

2012-08-06 Thread Derek Mahar
Turns out that FakeHapiConnectionHubFactory was not returning the same instance both when defining the matcher in when() and in the code under test. Consequently, the attach() method call under test did not match the when() matcher because though its arguments may have matched, the object instance

[HAPI-devel] Mock ConnectionHub.attach() with Mockito

2012-08-03 Thread Derek Mahar
How does one mock ConnectionHub.attach() using Mockito? Here is my unsuccessful attempt where the matcher fails to match: public TestHl7GatewayStatusUpdateSender() throws HL7Exception { mConnectionHubFactory = new FakeHapiConnectionHubFactory(); Connection fakeConnection =