PagingUtil { public static Map<String, String> parseLinkHeader(String linkHeader) { if (isNullOrEmpty(linkHeader)) { return emptyMap(); } final Map<String, String> res = new HashMap<>(); for (String part : linkHeader.split(LINK_HEADER_SEPARATOR)) { final Matcher matcher = LINK_HEADER_REGEX.matcher(part); if (matcher.matches()) { res.put(matcher.group("rel"), matcher.group("href")); } } return res; } private  PagingUtil(); static String createLinkHeader(Page<?> page, URI uri); static Map<String, String> parseLinkHeader(String linkHeader);  }
@Test public void testParsingLinksHeader() throws Exception { final Map<String, String> relToLinks = parseLinkHeader( "<http: + "<http: + "<http: + "<http: assertEquals(relToLinks.size(), 4); assertEquals( relToLinks.get("first"), "http: assertEquals( relToLinks.get("last"), "http: assertEquals( relToLinks.get("next"), "http: assertEquals( relToLinks.get("prev"), "http: }