(void)testAddConfig
{
[UMNavigationController setViewControllerName:@"ViewControllerA" forURL:@"
um://viewa2"];
NSMutableDictionary *config = [UMNavigationController config];
NSLog(@"%@"?? [config allKeys]);
HC_assertThat([config allKeys]??
HC_containsInAnyOrder(HC_equalTo(@"um://viewa2")?? HC_equalTo(@"
um://viewa")??
HC_equalTo(@"um://viewb")?? nil));
GHAssertEqualStrings(config[@"um://viewa2"]?? @"ViewControllerA"??
@"config set error.");
}

????????8??AddConfig????
?????????????
??????????????????????????????????????????????????????????????
????????????????????????OCHamcrest???????????????????????????????HC_containsInAnyOrder???????У??????????????collection???????????????????????????????????????????????????????????????9????????????maches:describingMismatchTo:?????У??????????collection?????????????????????????б??????????????matches:??????matches:????????????collection?????е????????????????matchers??????????????matchers???????????????????????????????matchers???????????????matchers?????????????????collection???????????????У?matches:?????????????????????????????????NO?????????????

 

(BOOL)matches:(id)item
{
NSUInteger index = 0;
for (id matcher in matchers)
{
if ([matcher matches:item])
{
[matchers removeObjectAtIndex:index];
return YES;
}
++index;
}
[[mismatchDescription appendText:@"not matched: "] appendDescriptionOf:item];
return NO;
}
- (BOOL)matches:(id)collection describingMismatchTo:(id)
mismatchDescription
{
if (![collection conformsToProtocol:@protocol(NSFastEnumeration)])
{
[super describeMismatchOf:collection to:mismatchDescription];
return NO;
}
HCMatchingInAnyOrder *matchSequence =
[[HCMatchingInAnyOrder alloc] initWithMatchers:matchers
mismatchDescription:mismatchDescription];
for (id item in collection)
if (![matchSequence matches:item])
return NO;
return [matchSequence isFinishedWith:collection];
}

????????9??HC_containsInAnyOrder?????е????????????
?????????????????????????б??????????????????????????????????????matches:?????е???????????????б????????YES??
????????????????HCIsCollectionContainingInAnyOrder????????μ?????????HCIsCollectionHavingInAnyOrder???????????????HC_hasInAnyOrder????д????matches:??????matches:describingMismatchTo:??????????10???????μ????????????HCMatchingInAnyOrderEx???????????????matches:??????????11??????????????????????????ж????Collection???????????????????