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

后端 未结 6 2095
佛祖请我去吃肉
佛祖请我去吃肉 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 22:54

    To make sure your method not called, I think we have to do an assert before the testMethod called. So make sure put OCMReject before you run the test method to listen which method will trigger when runs testMethod:

    OCMReject([mock someMethod]);
    [mock testMethod];
    

提交回复
热议问题