In this example you can use real object. You should use mocking when you need to, that is when you stub any method.
method pointer argument sets local ivar
-
04-07-2022 - |
문제
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.
해결책
제휴하지 않습니다 StackOverflow