XCTAssertThrowsSpecificNamed Build失败

时间:2015-01-05 19:28:12

标签: ios objective-c xctest

我正在尝试使用XCTAssertThrowsSpecificNamed来测试是否抛出了特定的异常,但是当我尝试使用它时构建失败。我不知道为什么。

以下是我的XCTestCase中的方法

- (void)testExceptionWasThrown {
    XCTAssertThrowsSpecificNamed([MyClassName throwThisWithName:@"abc"], NSException, @"coolExcption") //When I comment this out the Build passes.
}

...

这是类实现

@interface MyClassName : NSObject 
    + (void)throwThisWithName:(NSString *)name;
@end

@implementation MyClassName
    + (void)throwThisWithName:(NSString *)name {
        NSException* exception = [NSException exceptionWithName:@"coolException" reason:name userInfo:nil];
        @throw exception;  
    }
@end

0 个答案:

没有答案