2016-11-17 5 views
0

메소드 서명 :OCMockito 블록을 캡처하고 다른 기본 인수와 일치시키는 방법은 무엇입니까?

- (void)updateFeaturesButtons:(NSInteger)gameId 
       category:(FeatruesCategory)category 
       parentId:(NSInteger)parentId 
        success:(void (^)(NSDictionary* featuresJson))success 
        failure:(void (^)(NSError* error))failure 

내가 그렇게 다른 인수를 성공 블록 인수를 캡처하고 무시하려고 :

SuccessBlock block = captor.value; 
block(json); 
:

HCArgumentCaptor* captor = [[HCArgumentCaptor alloc] init]; 
[verify(mockManager) updateFeaturesButtons:0 category:0 parentId:0 success:(id)captor failure:anything()]; 

난 그냥 내 JSON와 성공 블록을 호출 할

하지만 내가받는 것은 argument(s) are different! 오류입니다. 다른 주장을하려면 어떻게해야합니까?

답변

1

OCMockito 설명서에서 How do you specify matchers for non-object arguments을 참조하십시오.

그래서 내가 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()]; 
+1

지정해야합니다,하지만 난 withMatcher''에 2 개 이상의 인수와 일치하는 모든 예제를 볼 수 없습니다. 고마워! – ccnyou