JsonApiParser { public static String normalizePath(String path) { String normalizedPath = DUPLICATE_SEPARATOR_PATTERN.matcher(path).replaceAll("/"); normalizedPath = StringUtils.removeEnd(normalizedPath, "/"); return StringUtils.removeStart(normalizedPath, "/"); }  static String normalizePath(String path); static ParseTree parse(String path);  }
@Test public void testNormalizePath() { String normalizedPath; normalizedPath = JsonApiParser.normalizePath("books/1/author"); assertEquals("books/1/author", normalizedPath, "it does not change normalized paths"); normalizedPath = JsonApiParser.normalizePath("/books"); assertEquals("books", normalizedPath, "it removes leading path separators"); normalizedPath = JsonApiParser.normalizePath("books/"); assertEquals("books", normalizedPath, "it removes trailing path separators"); normalizedPath = JsonApiParser.normalizePath(" assertEquals("books/1/author", normalizedPath, "it deduplicates path separators"); normalizedPath = JsonApiParser.normalizePath(" assertEquals("books/1/author", normalizedPath, "it deduplicates path separators"); }