RoutingTrie { @Nullable @VisibleForTesting Node<V> findNode(String path) { return findNode(path, false); } RoutingTrie(Node<V> root);   }
@Test void redirectMustHaveLowPrecedence() { final RoutingTrieBuilder<String> builder = new RoutingTrieBuilder<>(); final String high = "high"; final String low = "low"; builder.add("/foo", low, false); builder.add("/foo", high); builder.add("/bar/*", low, false); builder.add("/bar/*", high); builder.add("/baz/:", low, false); builder.add("/baz/:", high); builder.add("/foo_low_only", low, false); builder.add("/bar_low_only/*", low, false); builder.add("/baz_low_only/:", low, false); final RoutingTrie<String> trie = builder.build(); Node<String> node; node = trie.findNode("/foo"); assertThat(node).isNotNull(); assertThat(node.values).containsExactly(high, low); node = trie.findNode("/bar/"); assertThat(node).isNotNull(); assertThat(node.values).containsExactly(high, low); node = trie.findNode("/baz/1"); assertThat(node).isNotNull(); assertThat(node.values).containsExactly(high, low); node = trie.findNode("/foo_low_only"); assertThat(node).isNotNull(); assertThat(node.values).containsExactly(low); node = trie.findNode("/bar_low_only/"); assertThat(node).isNotNull(); assertThat(node.values).containsExactly(low); node = trie.findNode("/baz_low_only/1"); assertThat(node).isNotNull(); assertThat(node.values).containsExactly(low); }