@Test public void verifyAppServiceCalled_onAppCategorySelected() { AppCategorySelectionChangedEvent eventMock = mock(AppCategorySelectionChangedEvent.class); final AppCategory appCategoryMock = mock(AppCategory.class); when(appCategoryMock.getId()).thenReturn("mock category id"); List<AppCategory> selection = Lists.newArrayList(appCategoryMock); when(eventMock.getAppCategorySelection()).thenReturn(selection); when(appearanceMock.getAppsLoadingMask()).thenReturn("loading mask"); uut.onAppCategorySelectionChanged(eventMock); verify(viewMock).mask(anyString()); verify(appearanceMock).getAppsLoadingMask(); verify(appServiceMock).getApps(eq(appCategoryMock), appListCallbackCaptor.capture()); List<App> resultList = Lists.newArrayList(mock(App.class)); appListCallbackCaptor.getValue().onSuccess(resultList); verify(listStoreMock).clear(); verify(listStoreMock).addAll(eq(resultList)); verify(viewMock).unmask(); verifyNoMoreInteractions(appServiceMock, appearanceMock); }
@Override public void onAppCategorySelectionChanged(AppCategorySelectionChangedEvent event) { if (event.getAppCategorySelection().isEmpty()) { return; } Preconditions.checkArgument(event.getAppCategorySelection().size() == 1); view.mask(appearance.getAppsLoadingMask()); final AppCategory appCategory = event.getAppCategorySelection().iterator().next(); appService.getApps(appCategory, new AppListCallback()); }
AppsGridPresenterImpl implements AppsGridView.Presenter,
                                              AppNameSelectedEvent.AppNameSelectedEventHandler,
                                              AppRatingSelected.AppRatingSelectedHandler,
                                              AppRatingDeselected.AppRatingDeselectedHandler,
                                              AppCommentSelectedEvent.AppCommentSelectedEventHandler,
                                              AppFavoriteSelectedEvent.AppFavoriteSelectedEventHandler,
                                              AppUpdatedEvent.AppUpdatedEventHandler { @Override public void onAppCategorySelectionChanged(AppCategorySelectionChangedEvent event) { if (event.getAppCategorySelection().isEmpty()) { return; } Preconditions.checkArgument(event.getAppCategorySelection().size() == 1); view.mask(appearance.getAppsLoadingMask()); final AppCategory appCategory = event.getAppCategorySelection().iterator().next(); appService.getApps(appCategory, new AppListCallback()); } }
AppsGridPresenterImpl implements AppsGridView.Presenter,
                                              AppNameSelectedEvent.AppNameSelectedEventHandler,
                                              AppRatingSelected.AppRatingSelectedHandler,
                                              AppRatingDeselected.AppRatingDeselectedHandler,
                                              AppCommentSelectedEvent.AppCommentSelectedEventHandler,
                                              AppFavoriteSelectedEvent.AppFavoriteSelectedEventHandler,
                                              AppUpdatedEvent.AppUpdatedEventHandler { @Override public void onAppCategorySelectionChanged(AppCategorySelectionChangedEvent event) { if (event.getAppCategorySelection().isEmpty()) { return; } Preconditions.checkArgument(event.getAppCategorySelection().size() == 1); view.mask(appearance.getAppsLoadingMask()); final AppCategory appCategory = event.getAppCategorySelection().iterator().next(); appService.getApps(appCategory, new AppListCallback()); } @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 onAppCategorySelectionChanged(AppCategorySelectionChangedEvent event) { if (event.getAppCategorySelection().isEmpty()) { return; } Preconditions.checkArgument(event.getAppCategorySelection().size() == 1); view.mask(appearance.getAppsLoadingMask()); final AppCategory appCategory = event.getAppCategorySelection().iterator().next(); appService.getApps(appCategory, new AppListCallback()); } @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 onAppCategorySelectionChanged(AppCategorySelectionChangedEvent event) { if (event.getAppCategorySelection().isEmpty()) { return; } Preconditions.checkArgument(event.getAppCategorySelection().size() == 1); view.mask(appearance.getAppsLoadingMask()); final AppCategory appCategory = event.getAppCategorySelection().iterator().next(); appService.getApps(appCategory, new AppListCallback()); } @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);  }