@Test public void testOnAppFavoriteSelected() throws Exception { AppFavoriteSelectedEvent eventMock = mock(AppFavoriteSelectedEvent.class); App selectedAppMock = mock(App.class); when(eventMock.getApp()).thenReturn(selectedAppMock); uut.onAppFavoriteSelected(eventMock); verify(eventMock).getApp(); verify(appUserServiceMock).favoriteApp(eq(selectedAppMock), eq(true), voidCallbackCaptor.capture()); voidCallbackCaptor.getValue().onSuccess(null); verify(selectedAppMock).setFavorite(eq(true)); verify(eventBusMock, times(2)).fireEvent(any(AppFavoritedEvent.class)); verify(eventBusMock, times(2)).fireEvent(any(AppUpdatedEvent.class)); verifyNoMoreInteractions(eventBusMock, appUserServiceMock); verifyZeroInteractions(ontologyServiceMock); }
@Override public void onAppFavoriteSelected(AppFavoriteSelectedEvent event) { final App app = event.getApp(); appUserService.favoriteApp(app, !app.isFavorite(), new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { announcer.schedule(new ErrorAnnouncementConfig(appearance.favServiceFailure())); } @Override public void onSuccess(Void result) { app.setFavorite(!app.isFavorite()); eventBus.fireEvent(new AppFavoritedEvent(app)); eventBus.fireEvent(new AppUpdatedEvent(app)); } }); }
OntologyHierarchiesPresenterImpl implements OntologyHierarchiesView.Presenter,
                                                         OntologyHierarchySelectionChangedEvent.OntologyHierarchySelectionChangedEventHandler,
                                                         AppRatingSelected.AppRatingSelectedHandler,
                                                         AppRatingDeselected.AppRatingDeselectedHandler,
                                                         AppFavoriteSelectedEvent.AppFavoriteSelectedEventHandler,
                                                         DetailsHierarchyClicked.DetailsHierarchyClickedHandler,
                                                         DetailsCategoryClicked.DetailsCategoryClickedHandler { @Override public void onAppFavoriteSelected(AppFavoriteSelectedEvent event) { final App app = event.getApp(); appUserService.favoriteApp(app, !app.isFavorite(), new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { announcer.schedule(new ErrorAnnouncementConfig(appearance.favServiceFailure())); } @Override public void onSuccess(Void result) { app.setFavorite(!app.isFavorite()); eventBus.fireEvent(new AppFavoritedEvent(app)); eventBus.fireEvent(new AppUpdatedEvent(app)); } }); } }
OntologyHierarchiesPresenterImpl implements OntologyHierarchiesView.Presenter,
                                                         OntologyHierarchySelectionChangedEvent.OntologyHierarchySelectionChangedEventHandler,
                                                         AppRatingSelected.AppRatingSelectedHandler,
                                                         AppRatingDeselected.AppRatingDeselectedHandler,
                                                         AppFavoriteSelectedEvent.AppFavoriteSelectedEventHandler,
                                                         DetailsHierarchyClicked.DetailsHierarchyClickedHandler,
                                                         DetailsCategoryClicked.DetailsCategoryClickedHandler { @Override public void onAppFavoriteSelected(AppFavoriteSelectedEvent event) { final App app = event.getApp(); appUserService.favoriteApp(app, !app.isFavorite(), new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { announcer.schedule(new ErrorAnnouncementConfig(appearance.favServiceFailure())); } @Override public void onSuccess(Void result) { app.setFavorite(!app.isFavorite()); eventBus.fireEvent(new AppFavoritedEvent(app)); eventBus.fireEvent(new AppUpdatedEvent(app)); } }); } @Inject  OntologyHierarchiesPresenterImpl(OntologyHierarchiesViewFactory viewFactory,
                                            OntologyServiceFacade serviceFacade,
                                            EventBus eventBus,
                                            OntologyHierarchiesView.OntologyHierarchiesAppearance appearance); }
OntologyHierarchiesPresenterImpl implements OntologyHierarchiesView.Presenter,
                                                         OntologyHierarchySelectionChangedEvent.OntologyHierarchySelectionChangedEventHandler,
                                                         AppRatingSelected.AppRatingSelectedHandler,
                                                         AppRatingDeselected.AppRatingDeselectedHandler,
                                                         AppFavoriteSelectedEvent.AppFavoriteSelectedEventHandler,
                                                         DetailsHierarchyClicked.DetailsHierarchyClickedHandler,
                                                         DetailsCategoryClicked.DetailsCategoryClickedHandler { @Override public void onAppFavoriteSelected(AppFavoriteSelectedEvent event) { final App app = event.getApp(); appUserService.favoriteApp(app, !app.isFavorite(), new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { announcer.schedule(new ErrorAnnouncementConfig(appearance.favServiceFailure())); } @Override public void onSuccess(Void result) { app.setFavorite(!app.isFavorite()); eventBus.fireEvent(new AppFavoritedEvent(app)); eventBus.fireEvent(new AppUpdatedEvent(app)); } }); } @Inject  OntologyHierarchiesPresenterImpl(OntologyHierarchiesViewFactory viewFactory,
                                            OntologyServiceFacade serviceFacade,
                                            EventBus eventBus,
                                            OntologyHierarchiesView.OntologyHierarchiesAppearance appearance); @Override void go(final DETabPanel tabPanel); @Override void setViewDebugId(String baseID); @Override void onAppInfoSelected(final AppInfoSelectedEvent event); @Override void onAppSearchResultLoad(AppSearchResultLoadEvent event); @Override void onOntologyHierarchySelectionChanged(OntologyHierarchySelectionChangedEvent event); @Override void onAppRatingDeselected(AppRatingDeselected event); @Override void onAppRatingSelected(AppRatingSelected event); @Override void onAppFavoriteSelected(AppFavoriteSelectedEvent event); @Override void onDetailsHierarchyClicked(DetailsHierarchyClicked event); @Override void onDetailsCategoryClicked(DetailsCategoryClicked event); @Override HandlerRegistration addOntologyHierarchySelectionChangedEventHandler(
            OntologyHierarchySelectionChangedEvent.OntologyHierarchySelectionChangedEventHandler handler); }
OntologyHierarchiesPresenterImpl implements OntologyHierarchiesView.Presenter,
                                                         OntologyHierarchySelectionChangedEvent.OntologyHierarchySelectionChangedEventHandler,
                                                         AppRatingSelected.AppRatingSelectedHandler,
                                                         AppRatingDeselected.AppRatingDeselectedHandler,
                                                         AppFavoriteSelectedEvent.AppFavoriteSelectedEventHandler,
                                                         DetailsHierarchyClicked.DetailsHierarchyClickedHandler,
                                                         DetailsCategoryClicked.DetailsCategoryClickedHandler { @Override public void onAppFavoriteSelected(AppFavoriteSelectedEvent event) { final App app = event.getApp(); appUserService.favoriteApp(app, !app.isFavorite(), new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { announcer.schedule(new ErrorAnnouncementConfig(appearance.favServiceFailure())); } @Override public void onSuccess(Void result) { app.setFavorite(!app.isFavorite()); eventBus.fireEvent(new AppFavoritedEvent(app)); eventBus.fireEvent(new AppUpdatedEvent(app)); } }); } @Inject  OntologyHierarchiesPresenterImpl(OntologyHierarchiesViewFactory viewFactory,
                                            OntologyServiceFacade serviceFacade,
                                            EventBus eventBus,
                                            OntologyHierarchiesView.OntologyHierarchiesAppearance appearance); @Override void go(final DETabPanel tabPanel); @Override void setViewDebugId(String baseID); @Override void onAppInfoSelected(final AppInfoSelectedEvent event); @Override void onAppSearchResultLoad(AppSearchResultLoadEvent event); @Override void onOntologyHierarchySelectionChanged(OntologyHierarchySelectionChangedEvent event); @Override void onAppRatingDeselected(AppRatingDeselected event); @Override void onAppRatingSelected(AppRatingSelected event); @Override void onAppFavoriteSelected(AppFavoriteSelectedEvent event); @Override void onDetailsHierarchyClicked(DetailsHierarchyClicked event); @Override void onDetailsCategoryClicked(DetailsCategoryClicked event); @Override HandlerRegistration addOntologyHierarchySelectionChangedEventHandler(
            OntologyHierarchySelectionChangedEvent.OntologyHierarchySelectionChangedEventHandler handler);  }