erikdoe / ocmock

Mock objects for Objective-C
http://ocmock.org
Apache License 2.0
2.16k stars 606 forks source link

OCMockObject failed to tell what is the mock object when throwing assertions on `assertInvocationsArrayIsPresent` #380

Closed matrush closed 4 years ago

matrush commented 4 years ago

We have added the exception in https://github.com/erikdoe/ocmock/commit/3474a033aed40ac9458e5733b224ac0690fafde3, but it's kinda hard to know which mock has the issue.

Adding some descriptions can fix the issue. Before:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '** Cannot handle or verify invocations. This error usually occurs when a mock object is used after stopMocking has been called on it. In most cases it is not necessary to call stopMocking. If you know you have to, please make sure that the mock object is not used afterwards.'

After:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '** Cannot handle or verify invocations on OCMockObject(CLLocationManager). This error usually occurs when a mock object is used after stopMocking has been called on it. In most cases it is not necessary to call stopMocking. If you know you have to, please make sure that the mock object is not used afterwards.'