iosocmock

OCMock: OCMVerify times gets wrong count when using OCMPartialMock


OCMock Version: 3.6

Hi, I use OCMPartialMock to mock a config object. When I use the reference to the real object, it is right to verify the times the function networkStatusCacheTime in the object is called.

test success code

This is the screenshot -verifyInvocation:withQuantifier:atLocation: called when it is matching invocation to count. Only one invocation ocmock_replaced_networkStatusCacheTime can match.

test success debug


But the test failed when I use the reference to the mock object.

OCPartialMockObject(NATritonConfig): Method networkStatusCacheTime was invoked 2 times; but was expected once.

test failure code

Invocations networkStatusCacheTime and ocmock_replaced_networkStatusCacheTime both match by this time.

test failure debug


Is it different using the real object from the mock object? Maybe is it wrong the way I used?


Solution

  • This is a bug. I see you have opened an issue already: https://github.com/erikdoe/ocmock/issues/444