문제

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]
}
도움이 되었습니까?

해결책

You can use [[yourMock reject] setState:OCMOCK_ANY];

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top