方法签名:
- (void)updateFeaturesButtons:(NSInteger)gameId
category:(FeatruesCategory)category
parentId:(NSInteger)parentId
success:(void (^)(NSDictionary* featuresJson))success
failure:(void (^)(NSError* error))failure
我尝试捕获成功块参数并忽略其他参数,如:
HCArgumentCaptor* captor = [[HCArgumentCaptor alloc] init];
[verify(mockManager) updateFeaturesButtons:0 category:0 parentId:0 success:(id)captor failure:anything()];
我只是想调用成功块json:
SuccessBlock block = captor.value;
block(json);
但是我得到的只是argument(s) are different!
误差。对于其他的论点我该怎么做呢?
在OCMockito文档中,请参阅如何为非对象参数指定匹配器?
所以你需要指定
[[[[verify(mockManager)
withMatcher:anything() forArgument:0]
withMatcher:anything() forArgument:1]
withMatcher:anything() forArgument:2]
updateFeaturesButtons:0 category:0 parentId:0 success:(id)captor failure:anything()];