@Test public void goToSameProjectTest() { final WorkspaceProject project = new WorkspaceProject(activeOrganizationalUnit, activeRepository, activeBranch, activeModule); libraryPlaces.goToProject(project); verify(projectContextChangeEvent, never()).fire(any(WorkspaceProjectContextChangeEvent.class)); verify(placeManager, never()).forceCloseAllPlaces(); }
@Test public void closeAllPlacesOrNothingWithUncloseablePlacesTest() { final Command successCallback = mock(Command.class); final List<PlaceRequest> uncloseablePlaces = new ArrayList<>(); uncloseablePlaces.add(mock(PlaceRequest.class)); doReturn(uncloseablePlaces).when(placeManager).getUncloseablePlaces(); libraryPlaces.closeAllPlacesOrNothing(successCallback); verify(placeManager, never()).forceCloseAllPlaces(); verify(successCallback, never()).execute(); verify(closeUnsavedProjectAssetsPopUpPresenter).show(eq(activeProject), eq(uncloseablePlaces), any(), any()); }
public void closeAllPlacesOrNothing(final Command successCallback) { closingLibraryPlaces = true; final List<PlaceRequest> uncloseablePlaces = placeManager.getUncloseablePlaces(); if (uncloseablePlaces != null && uncloseablePlaces.isEmpty()) { placeManager.closeAllPlaces(); closingLibraryPlaces = false; if (successCallback != null) { successCallback.execute(); } } else { final Command newSuccessCallback = () -> { placeManager.forceCloseAllPlaces(); closingLibraryPlaces = false; if (successCallback != null) { successCallback.execute(); } }; closeUnsavedProjectAssetsPopUpPresenter.show(getActiveWorkspace(), uncloseablePlaces, newSuccessCallback, () -> placeManager.goTo(uncloseablePlaces.get(0))); } }