diff --git a/Source/OCMock/OCMMacroState.m b/Source/OCMock/OCMMacroState.m index e697c843..4cbe244d 100644 --- a/Source/OCMock/OCMMacroState.m +++ b/Source/OCMock/OCMMacroState.m @@ -40,7 +40,7 @@ + (OCMStubRecorder *)endStubMacro OCMStubRecorder *recorder = [[(OCMStubRecorder *)[globalState recorder] retain] autorelease]; BOOL didThrow = [globalState invocationDidThrow]; [threadDictionary removeObjectForKey:OCMGlobalStateKey]; - if(didThrow == NO && [recorder wasUsed] == NO) + if(didThrow == NO && [recorder didRecordInvocation] == NO) { [NSException raise:NSInternalInconsistencyException format:@"Did not record an invocation in OCMStub/OCMExpect/OCMReject.\n" @@ -106,7 +106,7 @@ + (void)endVerifyMacro OCMVerifier *verifier = [[(OCMVerifier *)[globalState recorder] retain] autorelease]; BOOL didThrow = [globalState invocationDidThrow]; [threadDictionary removeObjectForKey:OCMGlobalStateKey]; - if(didThrow == NO && [verifier wasUsed] == NO) + if(didThrow == NO && [verifier didRecordInvocation] == NO) { [NSException raise:NSInternalInconsistencyException format:@"Did not record an invocation in OCMVerify.\n" diff --git a/Source/OCMock/OCMObserverRecorder.h b/Source/OCMock/OCMObserverRecorder.h index dde66844..04d6a53b 100644 --- a/Source/OCMock/OCMObserverRecorder.h +++ b/Source/OCMock/OCMObserverRecorder.h @@ -29,6 +29,6 @@ - (BOOL)argument:(id)expectedArg matchesArgument:(id)observedArg; -- (BOOL)wasUsed; +- (BOOL)didRecordInvocation __used; @end diff --git a/Source/OCMock/OCMObserverRecorder.m b/Source/OCMock/OCMObserverRecorder.m index 46ddd44f..a3f35c57 100644 --- a/Source/OCMock/OCMObserverRecorder.m +++ b/Source/OCMock/OCMObserverRecorder.m @@ -38,7 +38,7 @@ - (void)dealloc [super dealloc]; } -- (BOOL)wasUsed +- (BOOL)didRecordInvocation { return YES; // Needed for macro use, and recorder can only end up in macro state if it was used. } diff --git a/Source/OCMock/OCMRecorder.h b/Source/OCMock/OCMRecorder.h index bcdf0fbd..b10d54df 100644 --- a/Source/OCMock/OCMRecorder.h +++ b/Source/OCMock/OCMRecorder.h @@ -24,7 +24,7 @@ { OCMockObject *mockObject; OCMInvocationMatcher *invocationMatcher; - BOOL wasUsed; + BOOL didRecordInvocation; BOOL shouldReturnMockFromInit; } @@ -36,7 +36,7 @@ - (void)setShouldReturnMockFromInit:(BOOL)flag; - (OCMInvocationMatcher *)invocationMatcher; -- (BOOL)wasUsed; +- (BOOL)didRecordInvocation; - (id)classMethod; - (id)ignoringNonObjectArgs; diff --git a/Source/OCMock/OCMRecorder.m b/Source/OCMock/OCMRecorder.m index dd175907..a611db72 100644 --- a/Source/OCMock/OCMRecorder.m +++ b/Source/OCMock/OCMRecorder.m @@ -27,7 +27,7 @@ @implementation OCMRecorder - (instancetype)init { // no super, we're inheriting from NSProxy - wasUsed = NO; + didRecordInvocation = NO; shouldReturnMockFromInit = NO; return self; } @@ -65,9 +65,9 @@ - (OCMInvocationMatcher *)invocationMatcher return invocationMatcher; } -- (BOOL)wasUsed +- (BOOL)didRecordInvocation { - return wasUsed; + return didRecordInvocation; } @@ -111,7 +111,7 @@ - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector - (void)forwardInvocation:(NSInvocation *)anInvocation { [anInvocation setTarget:nil]; - wasUsed = YES; + didRecordInvocation = YES; [invocationMatcher setInvocation:anInvocation]; // Code with ARC may retain the receiver of an init method before invoking it. In that case it @@ -128,7 +128,6 @@ - (void)forwardInvocation:(NSInvocation *)anInvocation - (void)doesNotRecognizeSelector:(SEL)aSelector __used { - wasUsed = YES; [NSException raise:NSInvalidArgumentException format:@"%@: cannot stub/expect/verify method '%@' because no such method exists in the mocked class.", mockObject, NSStringFromSelector(aSelector)]; }