0

如何验证使用 OCMockito 创建的模拟对象是否已收到带有原始参数的方法调用?

我要测试的方法是setProgress:(float)progress

    CompositeProgressView* mockProgress = mock([CompositeProgressView class]);
    self.downloader.progressView = mockProgress;
//run a task that increments progress
...
//test
    [verify(mockProgress) setProgress:anything()]; //does not work
4

1 回答 1

0
[[verify(mockProgress) withMatcher:anything()] setProgress:0];

“如何为原始参数指定匹配器?”中描述的 A 在https://github.com/jonreid/OCMockito

希望有帮助!

于 2015-03-30T12:33:10.063 回答