0

Here's the method I want to test:

-(bool) myMethod:(NSArray*) argArray {
    self.mArray = argArray;
    if (self.mArray == nil) {
        NSLog(@"Error - array is nil");
        return NO;
    }
    return YES;
}

I am not quite sure how to setup a test for this method. I want to test that if argArray is nil then it returns NO. I also want to test that if argArray is not nil then I return YES.

I'm not sure if I should have a mock NSArray object and see if it passes/fails, or if I should just use a real NSArray object.

dandan78
  • 13,328
  • 13
  • 64
  • 78
GW.Rodriguez
  • 1,181
  • 8
  • 18

1 Answers1

1

In this example you can use real object. You should use mocking when you need to, that is when you stub any method.

KamilPyc
  • 376
  • 1
  • 5