diff --git a/Source/OCMock/OCMExpectationRecorder.h b/Source/OCMock/OCMExpectationRecorder.h index 405aaa43..bfe7fc3b 100644 --- a/Source/OCMock/OCMExpectationRecorder.h +++ b/Source/OCMock/OCMExpectationRecorder.h @@ -16,6 +16,8 @@ #import +// NB Any new methods in this class should be prefixed with `ocm_` to prevent potential clashes with +// methods that are being stubbed in mock objects by clients. @interface OCMExpectationRecorder : OCMStubRecorder - (id)never; diff --git a/Source/OCMock/OCMMacroState.m b/Source/OCMock/OCMMacroState.m index 2842ab5d..32ff4c08 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 ocm_wasUsed] == 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 ocm_wasUsed] == 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..3398b2bb 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)ocm_wasUsed; @end diff --git a/Source/OCMock/OCMObserverRecorder.m b/Source/OCMock/OCMObserverRecorder.m index 46ddd44f..e34f7754 100644 --- a/Source/OCMock/OCMObserverRecorder.m +++ b/Source/OCMock/OCMObserverRecorder.m @@ -38,7 +38,7 @@ - (void)dealloc [super dealloc]; } -- (BOOL)wasUsed +- (BOOL)ocm_wasUsed { 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..ebc349b9 100644 --- a/Source/OCMock/OCMRecorder.h +++ b/Source/OCMock/OCMRecorder.h @@ -19,7 +19,8 @@ @class OCMockObject; @class OCMInvocationMatcher; - +// NB Any new methods in this class should be prefixed with `ocm_` to prevent potential clashes with +// methods that are being stubbed in mock objects by clients. @interface OCMRecorder : NSProxy { OCMockObject *mockObject; @@ -36,7 +37,7 @@ - (void)setShouldReturnMockFromInit:(BOOL)flag; - (OCMInvocationMatcher *)invocationMatcher; -- (BOOL)wasUsed; +- (BOOL)ocm_wasUsed; - (id)classMethod; - (id)ignoringNonObjectArgs; diff --git a/Source/OCMock/OCMRecorder.m b/Source/OCMock/OCMRecorder.m index dd175907..d2aeb7bd 100644 --- a/Source/OCMock/OCMRecorder.m +++ b/Source/OCMock/OCMRecorder.m @@ -65,7 +65,7 @@ - (OCMInvocationMatcher *)invocationMatcher return invocationMatcher; } -- (BOOL)wasUsed +- (BOOL)ocm_wasUsed { return wasUsed; } diff --git a/Source/OCMock/OCMStubRecorder.h b/Source/OCMock/OCMStubRecorder.h index 16557fe3..8e74a166 100644 --- a/Source/OCMock/OCMStubRecorder.h +++ b/Source/OCMock/OCMStubRecorder.h @@ -18,6 +18,8 @@ #import #import +// NB Any new methods in this class should be prefixed with `ocm_` to prevent potential clashes with +// methods that are being stubbed in mock objects by clients. @interface OCMStubRecorder : OCMRecorder - (id)andReturn:(id)anObject; diff --git a/Source/OCMock/OCMVerifier.h b/Source/OCMock/OCMVerifier.h index 164904fe..6c88ca0c 100644 --- a/Source/OCMock/OCMVerifier.h +++ b/Source/OCMock/OCMVerifier.h @@ -19,6 +19,8 @@ #import "OCMQuantifier.h" +// NB Any new methods in this class should be prefixed with `ocm_` to prevent potential clashes with +// methods that are being stubbed in mock objects by clients. @interface OCMVerifier : OCMRecorder @property(retain) OCMLocation *location;