方法签名:
- (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!
错误。
我能为其他论点做些什么?
答案 0 :(得分:2)
在OCMockito文档中,请参阅How do you specify matchers for non-object arguments?
所以你需要指定
{
prop1: revocable('Test prop'),
prop2: {
innerProp1: revocable(1),
innerProp2: revocable(2),
innerProp3: revocable(3)
},
revocableArray([1,2,3,4,5,6])
}