3

For method signature

- (void)insertValue:(NSUInteger)value;

I'm trying to see if insertValue for any value never gets called.

[verifyCount(test, never()) insertValue:0];

Since compiler complains anything() primitive types, how do I test this?

huggie
  • 17,587
  • 27
  • 82
  • 139

1 Answers1

5

It's just like https://stackoverflow.com/a/20524472/246895

[[verifyCount(test, never()) withMatcher:anything()]
    insertValue:0];

OCMockito does all argument checking using OCHamcrest matchers. Normally, OCMockito turns a primitive argument into an NSNumber, then wraps it in an implicit OCHamcrest equalTo matcher. But -withMatcher: and -withMatcher:forArgument replace the implicit matcher.

Community
  • 1
  • 1
Jon Reid
  • 20,545
  • 2
  • 64
  • 95