ios - OCMockito how to capture block and match any other primitive arguments? -


method signature:

- (void)updatefeaturesbuttons:(nsinteger)gameid                  category:(featruescategory)category                  parentid:(nsinteger)parentid                   success:(void (^)(nsdictionary* featuresjson))success                   failure:(void (^)(nserror* error))failure 

i try capture success block argument , ignore other arguments that:

hcargumentcaptor* captor = [[hcargumentcaptor alloc] init]; [verify(mockmanager) updatefeaturesbuttons:0 category:0 parentid:0 success:(id)captor failure:anything()]; 

i want call success block json:

successblock block = captor.value; block(json); 

but argument(s) different! error. can other arguments?

in ocmockito documentation, see how specify matchers non-object arguments?

so you'll need specify

[[[[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()]; 

Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -