Re: Creating mock of a class object
Re: Creating mock of a class object
- Subject: Re: Creating mock of a class object
- From: Nir Soffer <email@hidden>
- Date: Mon, 5 Jun 2006 22:44:52 +0300
On 05/06/2006, at 00:30, Nir Soffer wrote:
I'm trying to create a mock of a class, so I can fake a class
method, but seems that OCMock does not support this. Searching did
not reveal anything except one blogger that happen to have the same
problem.
I found a simple solution based on this article:
http://www-128.ibm.com/developerworks/library/j-mocktest.html
In short:
1. refactor the tested class to create the object we want to mock
with a factory method
2. create a subclass of the tested class, overriding the factory
method to return a mock object
3. test the subclass
Best Regards,
Nir Soffer
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden