OCMockObject and isKindOfClass

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.

OCMockObject and isKindOfClass

Postby Gbasile » 02 May 2013, 16:52

When using a mock created with mockForClass/niceMockForClass it would be useful to automatically stub isKindOfClass: to the relative class.
Is it already possible with OCMock and I have missed something, or you have some design motivation for this choice?
Gbasile
 

Re: OCMockObject and isKindOfClass

Postby erik » 08 May 2013, 14:50

Mock objects do implement isKindOfClass: and they return true when the class is passed is the mocked class or a subclass of it. This is the actual implementation:

Code: Select all
- (BOOL)isKindOfClass:(Class)aClass
{
    return [mockedClass isSubclassOfClass:aClass];
}


For various reasons OCMock does not overwrite the method named class. Calling class will return OCMockObject or one of the subclasses.
erik
 
Posts: 90
Joined: 10 Oct 2009, 15:22
Location: Hamburg, Germany


Return to OCMock