@Test public void partiallyMatchingUrlsMapToRootWhenApplicationIdNotAvailableWithStarConfig() { PathTrie<Integer> pathTrie = defaultpathTrieWithStar(); assertThat(pathTrie.get("/a/bar"), isValue(1)); assertThat(pathTrie.get("/a/foo"), isValue(1)); }
public Optional<T> get(String path) { List<String> components = getPathComponents(path); MatchTreeNode<T> node = tree.getLongestMatchingNode(components); if (node == null) { return Optional.empty(); } T value; if (isExactlyMatchingPath(node, path, components)) { value = node.value(); if (value == null) { value = bestValue(node.parent()); } } else { value = bestValue(node); } if (value == null) { return Optional.empty(); } return Optional.of(value); }
PathTrie { public Optional<T> get(String path) { List<String> components = getPathComponents(path); MatchTreeNode<T> node = tree.getLongestMatchingNode(components); if (node == null) { return Optional.empty(); } T value; if (isExactlyMatchingPath(node, path, components)) { value = node.value(); if (value == null) { value = bestValue(node.parent()); } } else { value = bestValue(node); } if (value == null) { return Optional.empty(); } return Optional.of(value); } }
PathTrie { public Optional<T> get(String path) { List<String> components = getPathComponents(path); MatchTreeNode<T> node = tree.getLongestMatchingNode(components); if (node == null) { return Optional.empty(); } T value; if (isExactlyMatchingPath(node, path, components)) { value = node.value(); if (value == null) { value = bestValue(node.parent()); } } else { value = bestValue(node); } if (value == null) { return Optional.empty(); } return Optional.of(value); } PathTrie(); }
PathTrie { public Optional<T> get(String path) { List<String> components = getPathComponents(path); MatchTreeNode<T> node = tree.getLongestMatchingNode(components); if (node == null) { return Optional.empty(); } T value; if (isExactlyMatchingPath(node, path, components)) { value = node.value(); if (value == null) { value = bestValue(node.parent()); } } else { value = bestValue(node); } if (value == null) { return Optional.empty(); } return Optional.of(value); } PathTrie(); void put(String path, T value); Optional<T> get(String path); T remove(String path); void printContent(); }
PathTrie { public Optional<T> get(String path) { List<String> components = getPathComponents(path); MatchTreeNode<T> node = tree.getLongestMatchingNode(components); if (node == null) { return Optional.empty(); } T value; if (isExactlyMatchingPath(node, path, components)) { value = node.value(); if (value == null) { value = bestValue(node.parent()); } } else { value = bestValue(node); } if (value == null) { return Optional.empty(); } return Optional.of(value); } PathTrie(); void put(String path, T value); Optional<T> get(String path); T remove(String path); void printContent();  }