NotificationPresenterImpl implements NotificationView.Presenter,
                                                  NotificationGridRefreshEvent.NotificationGridRefreshEventHandler,
                                                  NotificationSelectionEvent.NotificationSelectionEventHandler,
                                                  NotificationToolbarSelectionEvent.NotificationToolbarSelectionEventHandler,
                                                  NotificationToolbarDeleteClickedEvent.NotificationToolbarDeleteClickedEventHandler,
                                                  NotificationToolbarDeleteAllClickedEvent.NotificationToolbarDeleteAllClickedEventHandler { @Override public void onNotificationToolbarDeleteClicked(NotificationToolbarDeleteClickedEvent event) { final List<NotificationMessage> notifications = view.getSelectedItems(); final Command callback = new Command() { @Override public void execute() { view.loadNotifications(view.getCurrentLoadConfig()); } }; if (notifications != null && !notifications.isEmpty()) { JSONObject obj = new JSONObject(); JSONArray arr = new JSONArray(); int i = 0; for (NotificationMessage n : notifications) { arr.set(i++, new JSONString(n.getId())); } obj.put("uuids", arr); messageServiceFacade.deleteMessages(obj, new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(appearance.notificationDeleteFail(), caught); } @Override public void onSuccess(String result) { callback.execute(); DeleteNotificationsUpdateEvent event = new DeleteNotificationsUpdateEvent(notifications); eventBus.fireEvent(event); } }); } } @Inject  NotificationPresenterImpl(final NotificationViewFactory viewFactory,
                                     NotificationView.NotificationViewAppearance appearance,
                                     NotificationToolbarView toolbar,
                                     NotificationMessageProperties messageProperties); @Override void onNotificationGridRefresh(NotificationGridRefreshEvent event); @Override FilterPagingLoadConfig buildDefaultLoadConfig(); @Override void filterBy(NotificationCategory category); @Override void onNotificationSelection(NotificationSelectionEvent event); @Override void go(HasOneWidget container); @Override void onNotificationToolbarDeleteAllClicked(NotificationToolbarDeleteAllClickedEvent event); @Override void onNotificationToolbarDeleteClicked(NotificationToolbarDeleteClickedEvent event); @Override void onNotificationToolbarSelection(NotificationToolbarSelectionEvent event); @Override void setRefreshButton(TextButton refreshBtn); @Override NotificationCategory getCurrentCategory();  }
@Test public void testOnNotificationToolbarDeleteClicked() { NotificationToolbarDeleteClickedEvent eventMock = mock(NotificationToolbarDeleteClickedEvent.class); when(listMock.isEmpty()).thenReturn(false); when(listMock.size()).thenReturn(1); when(iteratorMock.hasNext()).thenReturn(true, false); when(iteratorMock.next()).thenReturn(notificationMessageMock); when(listMock.iterator()).thenReturn(iteratorMock); when(viewMock.getSelectedItems()).thenReturn(listMock); uut.onNotificationToolbarDeleteClicked(eventMock); verify(messageServiceFacadeMock).deleteMessages(isA(JSONObject.class), asyncCallbackStringCaptor.capture()); asyncCallbackStringCaptor.getValue().onSuccess("result"); verify(eventBusMock).fireEvent(isA(DeleteNotificationsUpdateEvent.class)); }