Вопрос

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