### Question:
PathTrie { public void put(String path, T value) { checkNotEmpty(path); requireNonNull(value); List<String> components = pathToComponents(Paths.get(removeAsterisk(path))); if (path.endsWith("/") || path.endsWith("/*")) { components.add("/"); } T existing = tree.getExactMatch(components); if (existing != null) { String message = format("Path '%s' has already been configured with a ID of [%s]", path, existing.toString()); throw new DuplicatePathException(message); } tree.addValueWithParents(components, value); } PathTrie(); void put(String path, T value); Optional<T> get(String path); T remove(String path); void printContent();  }### Answer:
@Test public void failWhenIdenticalPathsConfigured() { PathTrie<Integer> pathTrie = new PathTrie<>(); pathTrie.put("/a/b/c", 1); assertThrows(DuplicatePathException.class, () -> pathTrie.put("/a/b/c", 2)); }
@Test public void failWhenIdenticalPathsConfiguredWithStar() { PathTrie<Integer> pathTrie = new PathTrie<>(); pathTrie.put("/a/b/c/", 1); assertThrows(DuplicatePathException.class, () -> pathTrie.put("/a/b/c/*", 2)); }
@Test public void failWhenIdenticalPathsConfiguredInRoot() { PathTrie<Integer> pathTrie = new PathTrie<>(); pathTrie.put("/", 1); assertThrows(DuplicatePathException.class, () -> pathTrie.put("/", 2)); }
@Test public void failWhenIdenticalPathsConfiguredInRootWithStar() { PathTrie<Integer> pathTrie = new PathTrie<>(); pathTrie.put("/", 1); assertThrows(DuplicatePathException.class, () -> pathTrie.put("/*", 2)); }
@Test public void failWhenPathIsNull() { PathTrie<Integer> pathTrie = new PathTrie<>(); assertThrows(IllegalArgumentException.class, () -> pathTrie.put(null, 1)); }
@Test public void failWhenPathIsEmpty() { PathTrie<Integer> pathTrie = new PathTrie<>(); assertThrows(IllegalArgumentException.class, () -> pathTrie.put("", 1)); }
@Test public void failWhenValueIsNull() { PathTrie<Integer> pathTrie = new PathTrie<>(); assertThrows(NullPointerException.class, () -> pathTrie.put("/", null)); }