You can use [[yourMock reject] setState:OCMOCK_ANY];
OCMock: niceMockForClass expect zero call to method
-
30-06-2022 - |
質問
In a test with OCMock, I must assert that no call is made to the setState:
selector. However, I can make no assumption about the other calls that are made to the object.
Because any other call can be made, I have to (or do I?) use a niceMockForClass:
instead of mockForClass:
How can I then make sure that no call is made to setState:
?
The code roughly looks like this:
- (void)testNoCallIsMadeToSetStateOnReset
{
self.downloader = [OCMock niceMockForClass:[Downloader class]];
[[self.downloader expectZero] setState:OCMOCK_ANY]; // <- how to do this?
// do some stuff
[self.downloader verify]
}
解決
所属していません StackOverflow