AdminAppsGridPresenterImpl implements AdminAppsGridView.Presenter,
                                                   AppInfoSelectedEvent.AppInfoSelectedEventHandler,
                                                   SaveAppSelected.SaveAppSelectedHandler { @Override public void onDeleteAppsSelected(final DeleteAppsSelected event) { Preconditions.checkArgument(event.getAppsToBeDeleted().size() == 1); final App selectedApp = event.getAppsToBeDeleted().iterator().next(); view.mask(appearance.deleteAppLoadingMask()); adminAppService.deleteApp(selectedApp, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { view.unmask(); ErrorHandler.post(caught); } @Override public void onSuccess(Void result) { view.unmask(); view.getGrid().getSelectionModel().deselectAll(); listStore.remove(selectedApp); } }); } @Inject  AdminAppsGridPresenterImpl(final AdminAppsGridViewFactory viewFactory,
                               final ListStore<App> listStore); @Override HandlerRegistration addStoreRemoveHandler(StoreRemoveEvent.StoreRemoveHandler<App> handler); @Override void fireEvent(GwtEvent<?> event); @Override AdminAppsGridView getView(); @Override App getAppFromElement(Element eventTarget); @Override List<App> getSelectedApps(); @Override void onAppCategorySelectionChanged(AppCategorySelectionChangedEvent event); @Override void onAppInfoSelected(final AppInfoSelectedEvent event); @Override void onAppSearchResultLoad(AppSearchResultLoadEvent event); @Override void onDeleteAppsSelected(final DeleteAppsSelected event); @Override void onRestoreAppSelected(final RestoreAppSelected event); @Override void onSaveAppSelected(SaveAppSelected event); void updateBetaStatus(final App app);  }
@Test public void verifyAppServiceCalled_onDeleteAppsSelected() { verify(viewMock).addAppInfoSelectedEventHandler(Matchers.<AppInfoSelectedEvent.AppInfoSelectedEventHandler>any()); DeleteAppsSelected eventMock = mock(DeleteAppsSelected.class); final App appMock = mock(App.class); final ArrayList<App> appsToBeDeletedMock = Lists.newArrayList(appMock); when(eventMock.getAppsToBeDeleted()).thenReturn(appsToBeDeletedMock); uut.onDeleteAppsSelected(eventMock); verify(viewMock).mask(anyString()); verify(adminAppServiceMock).deleteApp(eq(appMock), voidCallbackCaptor.capture()); voidCallbackCaptor.getValue().onSuccess(null); verify(viewMock).unmask(); verify(viewMock).getGrid(); verify(gridMock).getSelectionModel(); verify(selectionModelMock).deselectAll(); verify(listStoreMock).remove(eq(appMock)); verifyNoMoreInteractions(viewMock, adminAppServiceMock, listStoreMock, gridMock, viewMock); verifyZeroInteractions(appServiceMock); }