Why is mock instance defined as id type?

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.

Why is mock instance defined as id type?

Postby leonard117 » 05 Sep 2014, 12:48

Hello, I am a noob at objective-c and OCMOck. I see in all usage of ocmock the mock object is defined as id and all mockForClass functions return id. Some of Objective-C engineers prefer more meaningful class type instead of id. Why can it not be the type of OCMockObject*? Is there any special reasons?
leonard117
 

Re: Why is mock instance defined as id type?

Postby erik » 19 Oct 2014, 16:15

Have you tried what happens when you declare the type of the mock to be OCMockObject* in your unit tests?
erik
 
Posts: 90
Joined: 10 Oct 2009, 15:22
Location: Hamburg, Germany


Return to OCMock