PathUtils { public static List<String> createPathParts(String path) { if (isNull(path)) { return emptyList(); } List<String> parts = new ArrayList<>(); StringTokenizer tokenizer = new StringTokenizer(path, "/"); while (tokenizer.hasMoreTokens()) { String token = tokenizer.nextToken().trim(); if (isNotEmpty(token)) { parts.add(token); } } return parts; }  static Map<String, PathParam> getPathParams(InternalRoute route, List<String> pathParts); static List<String> createPathParts(String path); static List<RoutePart<String>> createRoutePathParts(String path);  }
@Test public void path_multiple_parts() throws Exception { List<String> parts = PathUtils.createPathParts("/service/jokes/single"); assertEquals(asList("service", "jokes", "single"), parts); }
@Test public void path_one_part() throws Exception { List<String> parts = PathUtils.createPathParts("/service"); assertEquals(singletonList("service"), parts); }
@Test public void path_null_path() throws Exception { List<String> parts = PathUtils.createPathParts(null); assertEquals(emptyList(), parts); }
@Test public void path_double_slash() throws Exception { List<String> parts = PathUtils.createPathParts("/service assertEquals(asList("service", "jokes"), parts); }
@Test public void path_whitespace() throws Exception { List<String> parts = PathUtils.createPathParts("/service/ jokes "); assertEquals(asList("service", "jokes"), parts); }