RoutingTrie { void dump(OutputStream output) { final PrintWriter p = new PrintWriter(new OutputStreamWriter(output, StandardCharsets.UTF_8)); p.printf("Dump of %s:%n", this); dump(p, root, 0); p.flush(); } RoutingTrie(Node<V> root);   }
@Test void testParameterAndCatchAll() { final RoutingTrieBuilder<Object> builder = new RoutingTrieBuilder<>(); final Object value0 = new Object(); final Object value1 = new Object(); final Object value2 = new Object(); final Object value3 = new Object(); final Object value4 = new Object(); final Object value5 = new Object(); final Object value6 = new Object(); final Object value7 = new Object(); final Object value8 = new Object(); final Object value9 = new Object(); builder.add("/users/:", value0); builder.add("/users/:", value1); builder.add("/users/:/movies", value2); builder.add("/users/:/books", value3); builder.add("/users/:/books/harry_potter", value4); builder.add("/users/:/books/harry_potter*", value5); builder.add("/users/:/books/:", value6); builder.add("/users/:/movies/*", value7); builder.add("/:", value8); builder.add("/*", value9); final RoutingTrie<Object> trie = builder.build(); trie.dump(System.err); testNodeWithCheckingParentPath(trie, "/users/tom", "users/", value0, value1); testNodeWithCheckingParentPath(trie, "/users/tom/movies", "/", value2); testNodeWithCheckingParentPath(trie, "/users/tom/books", "/", value3); testNodeWithCheckingParentPath(trie, "/users/tom/books/harry_potter", "/", value4); testNodeWithCheckingParentPath(trie, "/users/tom/books/harry_potter1", "harry_potter", value5); testNodeWithCheckingParentPath(trie, "/users/tom/books/the_hunger_games", "/", value6); testNodeWithCheckingParentPath(trie, "/users/tom/movies/dunkirk", "/", value7); testNodeWithCheckingParentPath(trie, "/users/tom/movies/spider_man", "/", value7); testNodeWithCheckingParentPath(trie, "/faq", "/", value8); testNodeWithCheckingParentPath(trie, "/events/2017", "/", value9); testNodeWithCheckingParentPath(trie, "/", "/", value9); }