@Test public void verifyAppServiceCalled_onDeleteAppsSelected() { verify(eventBusMock).addHandler(Matchers.<GwtEvent.Type<AppsGridPresenterImpl>>any(), eq(uut)); DeleteAppsSelected eventMock = mock(DeleteAppsSelected.class); App mock1 = mock(App.class); App mock2 = mock(App.class); when(mock1.getId()).thenReturn("mock id 1"); when(mock2.getId()).thenReturn("mock id 2"); List<App> appsToBeDeleted = Lists.newArrayList(mock1, mock2); when(eventMock.getAppsToBeDeleted()).thenReturn(appsToBeDeleted); String mockUserName = "mock user name"; when(userInfoMock.getUsername()).thenReturn(mockUserName); String mockFullUserName = "mock full user name"; when(userInfoMock.getFullUsername()).thenReturn(mockFullUserName); uut.onDeleteAppsSelected(eventMock); verify(eventMock).getAppsToBeDeleted(); verify(appUserServiceMock).deleteAppsFromWorkspace(eq(appsToBeDeleted), Matchers.<AsyncCallback<Void>>any()); verifyNoMoreInteractions(appServiceMock, eventMock, eventBusMock, userInfoMock, mock1, mock2); }
@Override public void onDeleteAppsSelected(final DeleteAppsSelected event) { appUserService.deleteAppsFromWorkspace(event.getAppsToBeDeleted(), new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(appearance.appRemoveFailure(), caught); } @Override public void onSuccess(Void result) { for (App app : event.getAppsToBeDeleted()) { listStore.remove(app); } } }); }
AppsGridPresenterImpl implements AppsGridView.Presenter,
                                              AppNameSelectedEvent.AppNameSelectedEventHandler,
                                              AppRatingSelected.AppRatingSelectedHandler,
                                              AppRatingDeselected.AppRatingDeselectedHandler,
                                              AppCommentSelectedEvent.AppCommentSelectedEventHandler,
                                              AppFavoriteSelectedEvent.AppFavoriteSelectedEventHandler,
                                              AppUpdatedEvent.AppUpdatedEventHandler { @Override public void onDeleteAppsSelected(final DeleteAppsSelected event) { appUserService.deleteAppsFromWorkspace(event.getAppsToBeDeleted(), new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(appearance.appRemoveFailure(), caught); } @Override public void onSuccess(Void result) { for (App app : event.getAppsToBeDeleted()) { listStore.remove(app); } } }); } }
AppsGridPresenterImpl implements AppsGridView.Presenter,
                                              AppNameSelectedEvent.AppNameSelectedEventHandler,
                                              AppRatingSelected.AppRatingSelectedHandler,
                                              AppRatingDeselected.AppRatingDeselectedHandler,
                                              AppCommentSelectedEvent.AppCommentSelectedEventHandler,
                                              AppFavoriteSelectedEvent.AppFavoriteSelectedEventHandler,
                                              AppUpdatedEvent.AppUpdatedEventHandler { @Override public void onDeleteAppsSelected(final DeleteAppsSelected event) { appUserService.deleteAppsFromWorkspace(event.getAppsToBeDeleted(), new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(appearance.appRemoveFailure(), caught); } @Override public void onSuccess(Void result) { for (App app : event.getAppsToBeDeleted()) { listStore.remove(app); } } }); } @Inject  AppsGridPresenterImpl(final AppsGridViewFactory viewFactory,
                          final ListStore<App> listStore,
                          final EventBus eventBus,
                          OntologyServiceFacade ontologyService); }
AppsGridPresenterImpl implements AppsGridView.Presenter,
                                              AppNameSelectedEvent.AppNameSelectedEventHandler,
                                              AppRatingSelected.AppRatingSelectedHandler,
                                              AppRatingDeselected.AppRatingDeselectedHandler,
                                              AppCommentSelectedEvent.AppCommentSelectedEventHandler,
                                              AppFavoriteSelectedEvent.AppFavoriteSelectedEventHandler,
                                              AppUpdatedEvent.AppUpdatedEventHandler { @Override public void onDeleteAppsSelected(final DeleteAppsSelected event) { appUserService.deleteAppsFromWorkspace(event.getAppsToBeDeleted(), new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(appearance.appRemoveFailure(), caught); } @Override public void onSuccess(Void result) { for (App app : event.getAppsToBeDeleted()) { listStore.remove(app); } } }); } @Inject  AppsGridPresenterImpl(final AppsGridViewFactory viewFactory,
                          final ListStore<App> listStore,
                          final EventBus eventBus,
                          OntologyServiceFacade ontologyService); @Override HandlerRegistration addAppFavoritedEventHandler(AppFavoritedEvent.AppFavoritedEventHandler eventHandler); @Override HandlerRegistration addStoreAddHandler(StoreAddEvent.StoreAddHandler<App> handler); @Override HandlerRegistration addStoreClearHandler(StoreClearEvent.StoreClearHandler<App> handler); @Override HandlerRegistration addStoreRemoveHandler(StoreRemoveEvent.StoreRemoveHandler<App> handler); @Override HandlerRegistration addStoreUpdateHandler(StoreUpdateEvent.StoreUpdateHandler<App> handler); @Override void fireEvent(GwtEvent<?> event); App getDesiredSelectedApp(); @Override App getSelectedApp(); @Override AppsGridView getView(); @Override void onAppCategorySelectionChanged(AppCategorySelectionChangedEvent event); @Override void onOntologyHierarchySelectionChanged(OntologyHierarchySelectionChangedEvent event); @Override void onAppCommentSelectedEvent(AppCommentSelectedEvent event); @Override void onAppFavoriteSelected(AppFavoriteSelectedEvent event); @Override void onAppNameSelected(AppNameSelectedEvent event); @Override void onAppRatingDeselected(final AppRatingDeselected event); @Override void onAppRatingSelected(final AppRatingSelected event); @Override void onAppSearchResultLoad(AppSearchResultLoadEvent event); @Override void onAppUpdated(final AppUpdatedEvent event); @Override void onDeleteAppsSelected(final DeleteAppsSelected event); @Override void onRunAppSelected(RunAppSelected event); void setDesiredSelectedApp(final App desiredSelectedApp); }
AppsGridPresenterImpl implements AppsGridView.Presenter,
                                              AppNameSelectedEvent.AppNameSelectedEventHandler,
                                              AppRatingSelected.AppRatingSelectedHandler,
                                              AppRatingDeselected.AppRatingDeselectedHandler,
                                              AppCommentSelectedEvent.AppCommentSelectedEventHandler,
                                              AppFavoriteSelectedEvent.AppFavoriteSelectedEventHandler,
                                              AppUpdatedEvent.AppUpdatedEventHandler { @Override public void onDeleteAppsSelected(final DeleteAppsSelected event) { appUserService.deleteAppsFromWorkspace(event.getAppsToBeDeleted(), new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(appearance.appRemoveFailure(), caught); } @Override public void onSuccess(Void result) { for (App app : event.getAppsToBeDeleted()) { listStore.remove(app); } } }); } @Inject  AppsGridPresenterImpl(final AppsGridViewFactory viewFactory,
                          final ListStore<App> listStore,
                          final EventBus eventBus,
                          OntologyServiceFacade ontologyService); @Override HandlerRegistration addAppFavoritedEventHandler(AppFavoritedEvent.AppFavoritedEventHandler eventHandler); @Override HandlerRegistration addStoreAddHandler(StoreAddEvent.StoreAddHandler<App> handler); @Override HandlerRegistration addStoreClearHandler(StoreClearEvent.StoreClearHandler<App> handler); @Override HandlerRegistration addStoreRemoveHandler(StoreRemoveEvent.StoreRemoveHandler<App> handler); @Override HandlerRegistration addStoreUpdateHandler(StoreUpdateEvent.StoreUpdateHandler<App> handler); @Override void fireEvent(GwtEvent<?> event); App getDesiredSelectedApp(); @Override App getSelectedApp(); @Override AppsGridView getView(); @Override void onAppCategorySelectionChanged(AppCategorySelectionChangedEvent event); @Override void onOntologyHierarchySelectionChanged(OntologyHierarchySelectionChangedEvent event); @Override void onAppCommentSelectedEvent(AppCommentSelectedEvent event); @Override void onAppFavoriteSelected(AppFavoriteSelectedEvent event); @Override void onAppNameSelected(AppNameSelectedEvent event); @Override void onAppRatingDeselected(final AppRatingDeselected event); @Override void onAppRatingSelected(final AppRatingSelected event); @Override void onAppSearchResultLoad(AppSearchResultLoadEvent event); @Override void onAppUpdated(final AppUpdatedEvent event); @Override void onDeleteAppsSelected(final DeleteAppsSelected event); @Override void onRunAppSelected(RunAppSelected event); void setDesiredSelectedApp(final App desiredSelectedApp);  }