We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Based on the documentation:
OCMStub([mock someMethod]).andThrow(anException); When someMethod is invoked the stub will throw anException.
However it seems like a special exception is thrown instead of the provided one, the provided one is wrapped inside the userInfo
userInfo
ocmock/Source/OCMock/OCMExceptionReturnValueProvider.m
Lines 20 to 30 in 4e8ba16
@interface Dummy : NSObject - (void)method; - (void)throwException; @end @implementation Dummy - (void)method { @try { [self throwException]; } @catch (NSException *exception) { NSLog(@"exception %@ %@", exception.name, exception.reason); } } - (void)throwException { } @end @interface DummyTests : XCTestCase @end @implementation DummyTests - (void)testDummy { id dummyPartialMock = OCMPartialMock([Dummy new]); OCMStub([dummyPartialMock throwException]).andThrow([NSException exceptionWithName:@"name" reason:@"reason" userInfo:nil]); [dummyPartialMock method]; } @end
The printed message will be exception OCMStubbedException Exception stubbed in test instead of exception name reason.
exception OCMStubbedException Exception stubbed in test
exception name reason
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Based on the documentation:
However it seems like a special exception is thrown instead of the provided one, the provided one is wrapped inside the
userInfo
ocmock/Source/OCMock/OCMExceptionReturnValueProvider.m
Lines 20 to 30 in 4e8ba16
Repro
The printed message will be
exception OCMStubbedException Exception stubbed in test
instead ofexception name reason
.The text was updated successfully, but these errors were encountered: