1

I am using OCMock as a mocking framework in my iOS project. When I try to use OCVerify functionality to test that a certain method is invoked, I came across a problem of passing primitive types as parameters. Here is an example to show problem:

1-) Cases successfully verify invocation when no parameter or an object parameter.

OCMVerify([mockedClass methodToCall])
OCMVerify([mockedClass methodWithObjectParameter:[OCMArg any]);

2-) When I want to verify a method that takes an int as a parameter:

OCMVerify([mockedClass methodWithIntParameter:[OCMArg any]);

In this case [OCMArg any] doesn't act like as expected. It returns an actual integer and that causes a mismatch of parameter values. In reality I do not care if that integer value is correct or not. My only consideration is if the method is called with any integer regardless of its value.

I want to know that is there a way to have exact same effect of [OCMArg any] has on objects when using primitive types as parameters?

haven-way
  • 113
  • 1
  • 10

1 Answers1

1

Please see section 4 in the documentation.

Erik Doernenburg
  • 2,933
  • 18
  • 21