Unit testing iOS 10 notifications : <p>In my app I wish to assert that notifications have been added in the correct format. I'd normally do this with dependency injection, but I can't think of a way to test the new <code>UNUserNotificationCenter</code> API.</p>

<p>I started to create a mock object which would capture the notification request:</p>

<pre><code>import Foundation
import UserNotifications

class NotificationCenterMock: UNUserNotificationCenter {
    var request: UNNotificationRequest? = nil
    override func add(_ request: UNNotificationRequest, withCompletionHandler completionHandler: ((Error?) -&gt; Void)? = nil) {
        self.request = request
    }
}
</code></pre>

<p>However, <code>UNUserNotificationCenter</code> has no accessible initializers I can't instantiate the mock.</p>

<p>I'm not even sure I can test by adding the notification request and fetching the current notifications, as the tests would need to request permission on the Simulator which would stall the tests. Currently I've refactored the notification logic into a wrapper, so I can at least mock that throughout my application and manually test.</p>

<p>Do I have any better options than manual testing?</p>
