BookmarkableUrlHelper { public static Set<String> getScreensFromPlace(final PlaceRequest place) { String url; int start; int end; String docks; if (!isNotBlank(place)) { return new HashSet<>(); } if (isPerspectiveInUrl(place.getFullIdentifier())) { String request = place.getFullIdentifier(); url = request.substring(request.indexOf(PERSPECTIVE_SEP) + 1); } else { url = place.getFullIdentifier(); } start = url.indexOf(DOCK_BEGIN_SEP); end = url.indexOf(DOCK_CLOSE_SEP) + 1; if (start > 0) { docks = url.substring(start, end); url = url.replace(docks, ""); } url = url.replace(OTHER_SCREEN_SEP, SEPARATOR); String[] token = url.split(SEPARATOR); return new HashSet<>(Arrays.asList(token)); }  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 testGetScreensFromPlace() { final String url = "perspective|~screen1,screen2$!screen3,screen4"; final String url2 = "UFWidgets|PagedTableScreen[ESimpleDockScreen,!WSimpleDockScreen,ESimpleDockScreen,]"; final String url3 = "PagedTableScreen[ESimpleDockScreen,!WSimpleDockScreen,ESimpleDockScreen,]"; final PlaceRequest place = new DefaultPlaceRequest(url); final PlaceRequest place2 = new DefaultPlaceRequest(url2); final PlaceRequest placeNoPerspective = new DefaultPlaceRequest(url3); final PlaceRequest placeNull = null; Set<String> set = BookmarkableUrlHelper.getScreensFromPlace(place); assertNotNull(set); assertFalse(set.isEmpty()); assertEquals(4, set.size()); assertTrue(set.contains("~screen1")); assertTrue(set.contains("screen2")); assertTrue(set.contains("!screen3")); assertTrue(set.contains("screen4")); set = BookmarkableUrlHelper.getScreensFromPlace(place2); assertNotNull(set); assertFalse(set.isEmpty()); assertEquals(1, set.size()); assertTrue(set.contains("PagedTableScreen")); set = BookmarkableUrlHelper.getScreensFromPlace(placeNull); assertNotNull(set); assertTrue(set.isEmpty()); set = BookmarkableUrlHelper.getScreensFromPlace(placeNoPerspective); assertNotNull(set); assertFalse(set.isEmpty()); assertTrue(set.contains("PagedTableScreen")); }