0

I'm using OCMockito to mock some objects in my tests.

When I use verify I receive an error from Xcode:

Multiple methods named '.....' found with mismatched result, parameter type or attributes

In the readme of the project i found this note:

(If Xcode complains about multiple methods with the same name, cast verify to the mocked class.)

This is my original implementation:

__strong Class mockAdjustClass = mockClass([Adjust class]);
[verify(mockAdjustClass) trackEvent:hasProperty(@"callbackParameters", hasEntry(@"duration", isNot(@"0")))];

I tried to cast in different ways but i cannot get rid of the error, for example:

[verify(([Adjust class])mockAdjustClass) trackEvent:hasProperty(@"callbackParameters", hasEntry(@"duration", isNot(@"0")))];

[([Adjust class])verify(mockAdjustClass) trackEvent:hasProperty(@"callbackParameters", hasEntry(@"duration", isNot(@"0")))];
trojanfoe
  • 120,358
  • 21
  • 212
  • 242
IgnazioC
  • 4,554
  • 4
  • 33
  • 46

1 Answers1

0

I found the solution and was very easy :(

[(Adjust *)verify(mockAdjustClass) trackEvent:hasProperty(@"callbackParameters", hasEntry(@"duration", isNot(@"0")))];
IgnazioC
  • 4,554
  • 4
  • 33
  • 46