Expecting class method on mocked protocol

Discussion of the OCMock framework. If you have patches we would prefer you to send them to the mailing list, but attaching them to a topic is possible, too.

Expecting class method on mocked protocol

Postby graeme » 04 Mar 2014, 19:22

I am trying to test the call of a class method on a class which implements a protocol.

I assumed if it could be achieved it would be as follows:

Code: Select all
id mockMyProtocol = [OCMockObject niceMockForProtocol:@protocol(MyProtocol)];
[mockMyProtocol expect] someClassMethodWithArgument:[OSMArg any]];
[objectUnderTest methodUnderTest];
[mockMyProtocol verify];


But the tests simply fail with the error:

*** -[NSProxy doesNotRecognizeSelector:someClassMethodWithArgument:] called!

I'm aware testing expectations of class methods is a relatively new feature so I can understand if this isn't supported yet, but thought I'd ask just in case.

Thanks, Graeme.
graeme
 
Posts: 1
Joined: 04 Mar 2014, 19:11

Return to OCMock



cron