Confirm method call with handle argument in OCMockito layout

I have an OCMockito mock of QuestionBuilder class with the questionFromJSON: error: method. This method takes a descriptor error (NSError **) as an argument. How to check if a method is called?


Ive tried:

[verify(builder) questionsFromJSON:@"Fake JSON" error:nil]; 

and

 NSError *err; [verify(builder) questionsFromJSON:@"Fake JSON" error:&err]; 


Both give an error:

testQuestionJSONIsPassedToQuestionBuilder (QuestionCreationTests) failed:
*** - [NSProxy doesNotRecognizeSelector: questionsFromJSON: error:] called!

+4
source share
1 answer

I do not think OCMockito supports this; when I do this using data instead of checking, I get a strange error when the code under test calls a method with argument **. If possible, you may need to change your method signature to not accept NSError ** (if you have control over this code).

0
source

All Articles