diff --git a/Source/OCMock/NSInvocation+OCMAdditions.m b/Source/OCMock/NSInvocation+OCMAdditions.m index e591baf0..fb2aec2a 100644 --- a/Source/OCMock/NSInvocation+OCMAdditions.m +++ b/Source/OCMock/NSInvocation+OCMAdditions.m @@ -175,7 +175,7 @@ - (NSString *)invocationDescription unsigned int i; for(i = 2; i < numberOfArgs; i++) { - [description appendFormat:@"%@%@:", (i > 2 ? @" " : @""), selectorParts[(i - 2)]]; + [description appendFormat:@"%@%@:", (i > 2 ? @" " : @""), [selectorParts objectAtIndex:(i - 2)]]; [description appendString:[self argumentDescriptionAtIndex:i]]; } diff --git a/Source/OCMock/NSObject+OCMAdditions.m b/Source/OCMock/NSObject+OCMAdditions.m index f5067939..e4e0aaa2 100644 --- a/Source/OCMock/NSObject+OCMAdditions.m +++ b/Source/OCMock/NSObject+OCMAdditions.m @@ -34,13 +34,13 @@ + (IMP)instanceMethodForwarderForSelector:(SEL)aSelector BOOL needsStructureReturn; void *rawCacheKey[2] = { (void *)self, aSelector }; NSData *cacheKey = [NSData dataWithBytes:rawCacheKey length:sizeof(rawCacheKey)]; - NSNumber *cachedValue = _OCMReturnTypeCache[cacheKey]; + NSNumber *cachedValue = [_OCMReturnTypeCache objectForKey:cacheKey]; if(cachedValue == nil) { NSMethodSignature *sig = [self instanceMethodSignatureForSelector:aSelector]; needsStructureReturn = [sig usesSpecialStructureReturn]; - _OCMReturnTypeCache[cacheKey] = @(needsStructureReturn); + [_OCMReturnTypeCache setObject:@(needsStructureReturn) forKey:cacheKey]; } else { diff --git a/Source/OCMock/NSValue+OCMAdditions.m b/Source/OCMock/NSValue+OCMAdditions.m index d0bba4c4..59f9ad40 100644 --- a/Source/OCMock/NSValue+OCMAdditions.m +++ b/Source/OCMock/NSValue+OCMAdditions.m @@ -104,4 +104,4 @@ - (BOOL)getBytes:(void *)outputBuf objCType:(const char *)targetType } -@end \ No newline at end of file +@end diff --git a/Source/OCMock/OCMockObject.m b/Source/OCMock/OCMockObject.m index d8f47cf6..3132f890 100644 --- a/Source/OCMock/OCMockObject.m +++ b/Source/OCMock/OCMockObject.m @@ -167,7 +167,7 @@ - (id)verifyAtLocation:(OCMLocation *)location if([unsatisfiedExpectations count] == 1) { NSString *description = [NSString stringWithFormat:@"%@: expected method was not invoked: %@", - [self description], [unsatisfiedExpectations[0] description]]; + [self description], [[unsatisfiedExpectations objectAtIndex:0] description]]; OCMReportFailure(location, description); } else if([unsatisfiedExpectations count] > 0) @@ -180,7 +180,7 @@ - (id)verifyAtLocation:(OCMLocation *)location if([exceptions count] > 0) { NSString *description = [NSString stringWithFormat:@"%@: %@ (This is a strict mock failure that was ignored when it actually occured.)", - [self description], [exceptions[0] description]]; + [self description], [[exceptions objectAtIndex:0] description]]; OCMReportFailure(location, description); } @@ -275,14 +275,14 @@ - (BOOL)handleInvocation:(NSInvocation *)anInvocation }]; if(idx == NSNotFound) return NO; - OCMInvocationStub *stub = stubs[idx]; + OCMInvocationStub *stub = [stubs objectAtIndex:idx]; if([expectations containsObject:stub]) { - if(expectationOrderMatters && (expectations[0] != stub)) + if(expectationOrderMatters && ([expectations objectAtIndex:0] != stub)) { [NSException raise:NSInternalInconsistencyException format:@"%@: unexpected method invoked: %@\n\texpected:\t%@", - [self description], [stub description], [expectations[0] description]]; + [self description], [stub description], [[expectations objectAtIndex:0] description]]; } if([(OCMInvocationExpectation *)stub isSatisfied]) diff --git a/Source/OCMock/OCObserverMockObject.m b/Source/OCMock/OCObserverMockObject.m index a216d6db..7c0e9cdb 100644 --- a/Source/OCMock/OCObserverMockObject.m +++ b/Source/OCMock/OCObserverMockObject.m @@ -110,7 +110,7 @@ - (void)handleNotification:(NSNotification *)aNotification limit = expectationOrderMatters ? 1 : [recorders count]; for(i = 0; i < limit; i++) { - if([recorders[i] matchesNotification:aNotification]) + if([[recorders objectAtIndex:i] matchesNotification:aNotification]) { [recorders removeObjectAtIndex:i]; return; diff --git a/Source/OCMockTests/OCMStubRecorderTests.m b/Source/OCMockTests/OCMStubRecorderTests.m index c1ffdb16..25540799 100644 --- a/Source/OCMockTests/OCMStubRecorderTests.m +++ b/Source/OCMockTests/OCMStubRecorderTests.m @@ -52,7 +52,7 @@ - (void)testAddsReturnValueProvider NSArray *actionList = [(OCMInvocationStub *)[recorder invocationMatcher] invocationActions]; XCTAssertEqual((NSUInteger)1, [actionList count], @"Should have added one action."); - XCTAssertEqualObjects([OCMReturnValueProvider class], [actionList[0] class], @"Should have added correct action."); + XCTAssertEqualObjects([OCMReturnValueProvider class], [[actionList objectAtIndex:0] class], @"Should have added correct action."); } - (void)testAddsExceptionReturnValueProvider @@ -63,7 +63,7 @@ - (void)testAddsExceptionReturnValueProvider NSArray *actionList = [(OCMInvocationStub *)[recorder invocationMatcher] invocationActions]; XCTAssertEqual((NSUInteger)1, [actionList count], @"Should have added one action."); - XCTAssertEqualObjects([OCMExceptionReturnValueProvider class], [actionList[0] class], @"Should have added correct action."); + XCTAssertEqualObjects([OCMExceptionReturnValueProvider class], [[actionList objectAtIndex:0] class], @"Should have added correct action."); }