PathUtils { public static List<RoutePart<String>> createRoutePathParts(String path) { if (isNull(path)) { return emptyList(); } return createPathParts(path).stream() .map(part -> new RoutePart<>(RoutePart.Type.PATH, part, StringVariable.INSTANCE)) .collect(toList()); }  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 route_null_path() throws Exception { List<RoutePart<String>> parts = PathUtils.createRoutePathParts(null); assertEquals(emptyList(), parts); }
@Test public void route_multiple_parts() throws Exception { List<RoutePart<String>> routePathParts = PathUtils.createRoutePathParts("/service/jokes/single"); assertEquals(asList( new RoutePart<>(RoutePart.Type.PATH, "service", StringVariable.INSTANCE), new RoutePart<>(RoutePart.Type.PATH, "jokes", StringVariable.INSTANCE), new RoutePart<>(RoutePart.Type.PATH, "single", StringVariable.INSTANCE)), routePathParts); }