Search in sources :

Example 1 with NotificationsAdapter

use of com.intellij.notification.NotificationsAdapter in project intellij-community by JetBrains.

the class TaskManagerTest method testNotifications.

public void testNotifications() throws Exception {
    final Ref<Notification> notificationRef = new Ref<>();
    getProject().getMessageBus().connect(myFixture.getTestRootDisposable()).subscribe(Notifications.TOPIC, new NotificationsAdapter() {

        @Override
        public void notify(@NotNull Notification notification) {
            notificationRef.set(notification);
        }
    });
    TestRepository repository = new TestRepository() {

        @Override
        public Task[] getIssues(@Nullable String query, int max, long since) throws Exception {
            throw new Exception();
        }
    };
    myTaskManager.setRepositories(Collections.singletonList(repository));
    myTaskManager.updateIssues(null);
    assertNull(notificationRef.get());
    myTaskManager.getIssues("");
    assertNotNull(notificationRef.get());
}
Also used : NotificationsAdapter(com.intellij.notification.NotificationsAdapter) Ref(com.intellij.openapi.util.Ref) Notification(com.intellij.notification.Notification) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

Notification (com.intellij.notification.Notification)1 NotificationsAdapter (com.intellij.notification.NotificationsAdapter)1 Ref (com.intellij.openapi.util.Ref)1 Nullable (org.jetbrains.annotations.Nullable)1