如何验证使用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
答案 0 :(得分:0)
[[verify(mockProgress) withMatcher:anything()] setProgress:0];
在&#34中描述;如何为原始参数指定匹配器?"在https://github.com/jonreid/OCMockito。
希望有所帮助!