ocmockito
OCMockito: get SIGABRT in async when using MKTArgumentCaptor in a not called verification
- (void)test_pushRightController UINavigationController naviMock = mock(UINavigationController); XCTestExpectation *e = [self expectationWithDescription:#"xnothing"]; self.model.navi = mockNavi; [self.model.buttonTapCommand execute:nil]; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ MKTArgumentCaptor *captor = [[MKTArgumentCaptor alloc] init]; [[MKTVerify(capabilityMock) withMatcher:[captor capture] forArgument:0] pushViewController:HC_anything() animated:YES]; expect(captor.value).beInstanceOf([MyController class]); expect(((MyController*)captor.value).dataSource.pageType).equal(MyType); [e fulfill]; }); [self waitForExpectationsWithTimeout:5 handler:nil]; } This will receive a SIGABRT if the verification failed(when pushViewController:animated not called), if it is called, every thing is fine. I replaced dispatch_after with Specta's waitUntil, but it still get SIGABRT. Any idea? Crash stack trace: Thread 1Queue : com.apple.main-thread (serial) #0 0x0000000115c4e0ae in __pthread_kill () #1 0x0000000115c15500 in pthread_kill () #2 0x00000001159bca44 in abort () #3 0x000000010cf70d39 in uncaught_exception_handler () #4 0x000000011066030b in __handleUncaughtException () #5 0x00000001148c703d in _objc_terminate() () #6 0x00000001157e726e in std::__terminate(void (*)()) () #7 0x00000001157e72e3 in std::terminate() () #8 0x00000001148c6fc5 in objc_terminate () #9 0x00000001158e64bb in _dispatch_client_callout () #10 0x00000001158d0f2d in _dispatch_main_queue_callback_4CF () #11 0x00000001105c02e9 in __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ () #12 0x00000001105818a9 in __CFRunLoopRun () #13 0x0000000110580e08 in CFRunLoopRunSpecific () #14 0x00000001112043a1 in -[NSRunLoop(NSRunLoop) runMode:beforeDate:] () #15 0x0000000111243705 in -[NSRunLoop(NSRunLoop) runUntilDate:] () #16 0x0000000128cf7ef6 in waitUntilTimeout at /Users/carmelosui/guoguoDev/Pods/Specta/Specta/Specta/SpectaDSL.m:177 #17 0x0000000128cf7c79 in waitUntil at /Users/carmelosui/guoguoDev/Pods/Specta/Specta/Specta/SpectaDSL.m:165 #18 0x0000000128c792f1 in -[MailSearchCompanySelectTest test_domesticsCommandTriggerGoSelectBlock] at /Users/carmelosui/guoguoDev/Cainiao4iPhoneTests/MailSearchCompanySelectTest.m:58 #19 0x000000011054e7ac in __invoking___ () #20 0x000000011054e5fe in -[NSInvocation invoke] () #21 0x000000011f822820 in __24-[XCTestCase invokeTest]_block_invoke_2 () #22 0x000000011f8557c2 in -[XCTestContext performInScope:] () #23 0x000000011f822770 in -[XCTestCase invokeTest] () #24 0x000000011f822c0b in -[XCTestCase performTest:] () #25 0x000000011f8208d1 in -[XCTestSuite performTest:] () #26 0x000000011f8208d1 in -[XCTestSuite performTest:] () #27 0x000000011f80dadc in __25-[XCTestDriver _runSuite]_block_invoke () #28 0x000000011f82e2e3 in -[XCTestObservationCenter _observeTestExecutionForBlock:] () #29 0x000000011f80da28 in -[XCTestDriver _runSuite] () #30 0x000000011f80e787 in -[XCTestDriver _checkForTestManager] () #31 0x000000011f856b23 in _XCTestMain () #32 0x000000011058bffc in __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ () #33 0x0000000110581c85 in __CFRunLoopDoBlocks () #34 0x00000001105813e2 in __CFRunLoopRun () #35 0x0000000110580e08 in CFRunLoopRunSpecific () #36 0x000000011687bad2 in GSEventRunModal () #37 0x00000001126e830d in UIApplicationMain () #38 0x000000010c58a994 in main at /Users/carmelosui/guoguoDev/Cainiao4iPhone/main.m:13 #39 0x000000011591592d in start () #40 0x000000011591592d in start ()
Related Links
OCMockito: get SIGABRT in async when using MKTArgumentCaptor in a not called verification