Reputation: 1091
I have an OCMockito mock of a class QuestionBuilder with the method questionsFromJSON:error:. This method accepts a handle (NSError **)error as an argument. How do I verify the method was called?
I’ve tried:
[verify(builder) questionsFromJSON:@"Fake JSON"
error:nil];
and:
NSError *err;
[verify(builder) questionsFromJSON:@"Fake JSON"
error:&err];
Both issue the error:
testQuestionJSONIsPassedToQuestionBuilder (QuestionCreationTests) failed:
*** -[NSProxy doesNotRecognizeSelector:questionsFromJSON:error:] called!
Upvotes: 4
Views: 492
Reputation: 8924
I don't think OCMockito supports this yet; when I do it using given instead of verify, i get a weird error when the code under test calls the method with the ** argument. If possible you may have to modify your method signature to not take in an NSError** (if you have control over that code).
Upvotes: 0