• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Creating mock of a class object
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Creating mock of a class object (From: Nir Soffer <email@hidden>)

  • Prev by Date: Auto sizing and locating
  • Next by Date: How to write a dictionary into an output file
  • Previous by thread: Creating mock of a class object
  • Next by thread: Printing page breaks in an attributed string?
  • Index(es):
    • Date
    • Thread