4

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!

Endersstocker
  • 1,061
  • 9
  • 26

1 Answers1

0

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).

Kevlar
  • 8,804
  • 9
  • 55
  • 81