OntologyHierarchiesPresenterImpl implements OntologyHierarchiesView.Presenter,
                                                         OntologyHierarchySelectionChangedEvent.OntologyHierarchySelectionChangedEventHandler,
                                                         AppRatingSelected.AppRatingSelectedHandler,
                                                         AppRatingDeselected.AppRatingDeselectedHandler,
                                                         AppFavoriteSelectedEvent.AppFavoriteSelectedEventHandler,
                                                         DetailsHierarchyClicked.DetailsHierarchyClickedHandler,
                                                         DetailsCategoryClicked.DetailsCategoryClickedHandler { @Override public void onAppInfoSelected(final AppInfoSelectedEvent event) { appDetailsDlgAsyncProvider.get(new AsyncCallback<AppDetailsDialog>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(caught); } @Override public void onSuccess(final AppDetailsDialog dlg) { App app = event.getApp(); appUserService.getAppDetails(app, new AppDetailsCallback(app, dlg)); } }); } @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);  }
@Test public void testOnAppInfoSelected_HPCApp() throws Exception { AppInfoSelectedEvent eventMock = mock(AppInfoSelectedEvent.class); when(eventMock.getApp()).thenReturn(appMock); when(appMock.getAppType()).thenReturn(App.EXTERNAL_APP); when(appMock.getGroups()).thenReturn(appCategoryListMock); when(appMock.getHierarchies()).thenReturn(hierarchyListMock); when(avuListMock.iterator()).thenReturn(avuIteratorMock); uut.onAppInfoSelected(eventMock); verify(appDetailsDialogProviderMock).get(appDetailsDialogCallback.capture()); appDetailsDialogCallback.getValue().onSuccess(appDetailsDialogMock); verify(appUserServiceMock).getAppDetails(eq(appMock), appDetailsCallback.capture()); appDetailsCallback.getValue().onSuccess(appMock); verify(categoryTreeStoreMock).add(appCategoryListMock); verify(appDetailsDialogMock).show(eq(appMock), anyString(), eq(hierarchyTreeStoreMock), eq(categoryTreeStoreMock), Matchers.<AppFavoriteSelectedEvent.AppFavoriteSelectedEventHandler>any(), Matchers.<AppRatingSelected.AppRatingSelectedHandler>any(), Matchers.<AppRatingDeselected.AppRatingDeselectedHandler>any(), Matchers.<DetailsHierarchyClicked.DetailsHierarchyClickedHandler>any(), Matchers.<DetailsCategoryClicked.DetailsCategoryClickedHandler>any()); verifyNoMoreInteractions(ontologyServiceMock, appUserServiceMock, ontologyUtilMock); }
@Test public void testOnAppInfoSelected_UnclassifiedApp() throws Exception { AppInfoSelectedEvent eventMock = mock(AppInfoSelectedEvent.class); when(eventMock.getApp()).thenReturn(appMock); when(appMock.getAppType()).thenReturn("DE"); when(appMock.getGroups()).thenReturn(appCategoryListMock); when(appMock.getHierarchies()).thenReturn(hierarchyListMock); when(avuListMock.iterator()).thenReturn(avuIteratorMock); when(hierarchyListMock.size()).thenReturn(0); uut.onAppInfoSelected(eventMock); verify(appDetailsDialogProviderMock).get(appDetailsDialogCallback.capture()); appDetailsDialogCallback.getValue().onSuccess(appDetailsDialogMock); verify(appUserServiceMock).getAppDetails(eq(appMock), appDetailsCallback.capture()); appDetailsCallback.getValue().onSuccess(appMock); verifyZeroInteractions(categoryTreeStoreMock); verify(appDetailsDialogMock).show(eq(appMock), anyString(), eq(hierarchyTreeStoreMock), eq(categoryTreeStoreMock), Matchers.<AppFavoriteSelectedEvent.AppFavoriteSelectedEventHandler>any(), Matchers.<AppRatingSelected.AppRatingSelectedHandler>any(), Matchers.<AppRatingDeselected.AppRatingDeselectedHandler>any(), Matchers.<DetailsHierarchyClicked.DetailsHierarchyClickedHandler>any(), Matchers.<DetailsCategoryClicked.DetailsCategoryClickedHandler>any()); verifyNoMoreInteractions(ontologyServiceMock, appUserServiceMock, ontologyUtilMock); }
@Test public void testOnAppInfoSelected_ClassifiedApp() throws Exception { AppInfoSelectedEvent eventMock = mock(AppInfoSelectedEvent.class); when(eventMock.getApp()).thenReturn(appMock); when(appMock.getAppType()).thenReturn("DE"); when(avuListMock.iterator()).thenReturn(avuIteratorMock); uut.onAppInfoSelected(eventMock); verify(appDetailsDialogProviderMock).get(appDetailsDialogCallback.capture()); appDetailsDialogCallback.getValue().onSuccess(appDetailsDialogMock); verify(appUserServiceMock).getAppDetails(eq(appMock), appDetailsCallback.capture()); appDetailsCallback.getValue().onSuccess(appMock); verifyZeroInteractions(categoryTreeStoreMock); verify(appDetailsDialogMock).show(eq(appMock), anyString(), eq(hierarchyTreeStoreMock), eq(categoryTreeStoreMock), Matchers.<AppFavoriteSelectedEvent.AppFavoriteSelectedEventHandler>any(), Matchers.<AppRatingSelected.AppRatingSelectedHandler>any(), Matchers.<AppRatingDeselected.AppRatingDeselectedHandler>any(), Matchers.<DetailsHierarchyClicked.DetailsHierarchyClickedHandler>any(), Matchers.<DetailsCategoryClicked.DetailsCategoryClickedHandler>any()); verifyNoMoreInteractions(ontologyServiceMock, appUserServiceMock, ontologyUtilMock); }