BookmarkableUrlHelper { public static String registerClosedDock(String currentBookmarkableURLStatus, UberfireDock targetDock) { if (!isNotBlank(currentBookmarkableURLStatus) || null == targetDock) { return currentBookmarkableURLStatus; } final String id = getDockId(targetDock); final String closed = CLOSED_DOCK_PREFIX.concat(id); if (!currentBookmarkableURLStatus.contains(closed)) { return currentBookmarkableURLStatus.replace(id, CLOSED_DOCK_PREFIX.concat(id)); } return currentBookmarkableURLStatus; }  static String registerOpenedScreen(String bookmarkableUrl,
                                              final PlaceRequest placeRequest); static String registerClose(String bookmarkableUrl,
                                       final String screenName); static PlaceRequest getPerspectiveFromPlace(PlaceRequest place); static boolean isPerspectiveScreen(final String bookmarkableUrl,
                                              final String screen); static boolean isPerspectiveInUrl(final String url); static boolean urlContainsExtraPerspectiveScreen(final String bookmarkableUrl); static String getUrlToken(final String bookmarkableUrl,
                                     final String screen); static Set<String> getDockedScreensFromUrl(final String url); static Set<String> getDockedScreensFromPlace(final PlaceRequest place); static Set<String> getScreensFromPlace(final PlaceRequest place); static Set<String> getClosedScreenFromPlace(final PlaceRequest place); static Set<String> getOpenedScreenFromPlace(final PlaceRequest place); static boolean isScreenClosed(final String bookmarkableUrl,
                                         String screen); static String registerOpenedPerspective(String currentBookmarkableURLStatus,
                                                   PlaceRequest place); static String registerOpenedDock(String currentBookmarkableURLStatus,
                                            UberfireDock targetDock); static String registerClosedDock(String currentBookmarkableURLStatus,
                                            UberfireDock targetDock); static String registerCloseEditor(final String currentBookmarkableURLStatus,
                                             final PlaceRequest place); final static String PERSPECTIVE_SEP; final static String DOCK_BEGIN_SEP; final static String DOCK_CLOSE_SEP; final static String SEPARATOR; final static String OTHER_SCREEN_SEP; final static String CLOSED_PREFIX; final static String CLOSED_DOCK_PREFIX; final static int MAX_NAV_URL_SIZE; }
@Test public void testRegisterClosedDock() { final String dockName1 = "dockedScreen1"; final String dockName2 = "dockedScreen2"; String perspectiveName = "perspective"; String url = "perspectiveName|screen[W" + dockName1 + ",W" + dockName2 + ",]"; UberfireDock dock1 = createUberfireDockForTest(dockName1, perspectiveName); UberfireDock dock2 = createUberfireDockForTest(dockName2, perspectiveName); url = BookmarkableUrlHelper.registerClosedDock(url, dock1); assertNotNull(url); assertTrue(url.contains("!W" + dockName1)); url = BookmarkableUrlHelper.registerClosedDock(url, dock2); assertNotNull(url); assertTrue(url.contains("!W" + dockName2)); }
@Test public void testDoubleRegisterClosedDock() { final String dockName1 = "dockedScreen1"; final String dockName2 = "dockedScreen2"; String perspectiveName = "perspective"; String url = "perspectiveName|screen[W" + dockName1 + ",W" + dockName2 + ",]"; UberfireDock dock1 = createUberfireDockForTest(dockName1, perspectiveName); UberfireDock dock2 = createUberfireDockForTest(dockName2, perspectiveName); url = BookmarkableUrlHelper.registerClosedDock(url, dock1); url = BookmarkableUrlHelper.registerClosedDock(url, dock1); assertNotNull(url); assertTrue(url.contains("!W" + dockName1)); url = BookmarkableUrlHelper.registerClosedDock(url, dock2); url = BookmarkableUrlHelper.registerClosedDock(url, dock2); assertNotNull(url); assertTrue(url.contains("!W" + dockName2)); String expected = "anyBookmarkableUrl"; url = BookmarkableUrlHelper.registerClosedDock(expected, null); assertNotNull(url); assertEquals(expected, url); expected = " "; url = BookmarkableUrlHelper.registerClosedDock(expected, dock2); assertNotNull(url); assertEquals(expected, url); }