How can I use OCMock to verify that a method is never called?

后端 未结 6 2085
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-06 22:32

At my day job I\'ve been spoiled with Mockito\'s never() verification, which can confirm that a mock method is never called.

Is there some way to accomplish the same thi

6条回答
  •  走了就别回头了
    2021-02-06 23:15

    Starting from version 3.3 OCMock has OCMReject macro.

        id mock = OCMClassMock([MyObject class]);
        OCMReject([mock forbiddenMethod]);
    
        // exception will raise
        [mock forbiddenMethod];
    

提交回复
热议问题