Created
June 19, 2014 06:47
-
-
Save zats/e4dda53dc729f7a97cd5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface Calculator : NSObject | |
- (NSNumber *)methodA; | |
- (NSNumber *)methodB; | |
@end | |
@implementation Calculator | |
- (NSNumber *)methodA { | |
return [self methodB]; | |
} | |
- (NSNumber *)methodB { | |
return @0; | |
} | |
@end | |
Calculator *originalObject = [[Calculator alloc] init]; | |
Calculator *partialMock = OCMPartialMock(originalObject); | |
[OCMStub([partialMock methodB]) andReturn:@42]; | |
XCTAssertEqualObjects([partialMock methodA], @42, @"Expecting 42"); | |
XCTAssertEqualObjects([originalObject methodA], @0, @"Expecting 0"); // Fails here, returns 42 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment