Questions tagged [ocmock]

OCMock is an Objective-C implementation of mock objects.

The OCMock framework provides the ability of using mock objects in Objective-C applications. Some of the functionality in the framework is:

  • Create fail-fast and nice mocks.
  • Ability to stub and return predetermined values.
  • Mock instance and class methods.
  • Mock protocols and notification observers.
  • Partial mocks to stand in for a real object.
  • Forward messages to other objects.

Relevant links

Web site

Source

484 questions
0
votes
2 answers

OCMock: Setup syntax for checking parameters

I am trying to setup a OCMock to be verified. I have a protocol, TaskManagerDelegate, that contains the following method, - (void) addTasks:(NSArray * ) tasksToAdd; After setting up my mock object like this, id mockTaskManagerDelegate =…
MuffinMan
  • 1
  • 1
0
votes
2 answers

OCMock - is a call to "verify" needed to assert that a method is called on the mock object?

I'm confused as to what the method "verify" on OCMockObject does, is it necessary to call this to test whether a method was called on the mock object? Even if I don't actually call "verify" after the test was executed, I will still get test…
Andy Obusek
  • 12,614
  • 4
  • 41
  • 62
0
votes
1 answer

OCMock - trying to mock NSEntityDescription

in order to test a managed class I tried to create an instance in a unit test by first trying to mock NSEntityDescription and NSManagedObjectContext. id mockEntityDesc = [OCMockObject niceMockForClass:[NSEntityDescription class]]; id…
-1
votes
1 answer

OCMock doesn't work properly in iOS?

I created the following class: @implementation BCGlobalConstantBox + (instancetype)sharedInstance { static BCGlobalConstantBox *instance = nil; static dispatch_once_t predicate; dispatch_once( &predicate, ^{ instance = [[self…
Gargo
  • 1,135
  • 1
  • 10
  • 21
1 2 3
32
33