diff options
author | Frank Elias <francois.elias@livio.io> | 2021-02-11 17:49:19 -0500 |
---|---|---|
committer | Frank Elias <francois.elias@livio.io> | 2021-02-11 17:49:19 -0500 |
commit | 0dd58bc4ea25a9faf07c1399af2b2d61fafe3068 (patch) | |
tree | db1aa9c41ef771693f0f4e63fb5e7fbec878bd5c | |
parent | 74852b52f2b01cd8131cbc188c826172cbfa49c2 (diff) | |
download | sdl_ios-bugfix/issue-1913-observerMock-is-deprecated.tar.gz |
OCMObserverMock removalbugfix/issue-1913-observerMock-is-deprecated
Replaced with XCTNSNotificationExpectation
-rw-r--r-- | SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleSystemRequestHandlerSpec.m | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleSystemRequestHandlerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleSystemRequestHandlerSpec.m index d606b9fc0..683d3caf1 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleSystemRequestHandlerSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleSystemRequestHandlerSpec.m @@ -123,7 +123,7 @@ describe(@"SDLLifecycleSystemRequestHandler tests", ^{ }); context(@"of type LOCK_SCREEN_URL", ^{ - __block id lockScreenIconObserver = nil; + __block XCTNSNotificationExpectation *lockScreenIconExpectation; beforeEach(^{ receivedSystemRequest.requestType = SDLRequestTypeLockScreenIconURL; @@ -131,20 +131,19 @@ describe(@"SDLLifecycleSystemRequestHandler tests", ^{ UIImage *testImage = [UIImage imageNamed:@"testImagePNG" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil]; OCMStub([mockCacheManager retrieveImageForRequest:[OCMArg any] withCompletionHandler:([OCMArg invokeBlockWithArgs:testImage, [NSNull null], nil])]); - lockScreenIconObserver = OCMObserverMock(); - [[NSNotificationCenter defaultCenter] addMockObserver:lockScreenIconObserver name:SDLDidReceiveLockScreenIcon object:nil]; - [[lockScreenIconObserver expect] notificationWithName:SDLDidReceiveLockScreenIcon object:[OCMArg any] userInfo:[OCMArg any]]; + lockScreenIconExpectation = [[XCTNSNotificationExpectation alloc] initWithName:SDLDidReceiveLockScreenIcon object:nil]; SDLRPCNotificationNotification *notification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidReceiveSystemRequestNotification object:nil rpcNotification:receivedSystemRequest]; [[NSNotificationCenter defaultCenter] postNotification:notification]; }); it(@"should pass the url to the cache manager and then send a notification", ^{ - OCMVerifyAll(lockScreenIconObserver); + XCTWaiterResult waiter = [XCTWaiter waitForExpectations:@[lockScreenIconExpectation] timeout:4]; + XCTAssertEqual(waiter, XCTWaiterResultCompleted); }); afterEach(^{ - lockScreenIconObserver = nil; + lockScreenIconExpectation = nil; }); }); |