### Question:
RadixTreeImpl implements RadixTree<T>, Formattable { public void insert(String key, T value) throws DuplicateKeyException { try { insert(key, root, value); } catch (DuplicateKeyException e) { throw new DuplicateKeyException("Duplicate key: '" + key + "'"); } size++; } RadixTreeImpl(); T find(String key); boolean delete(String key); void insert(String key, T value); ArrayList<T> searchPrefix(String key, int recordLimit); boolean contains(String key); void visit(String key, Visitor<T, R> visitor); long getSize(); @Deprecated void display(); @Override void formatTo(Formatter formatter, int flags, int width, int precision); String complete(String prefix);  }### Answer:
@Test public void testInsert() { trie.insert("apple", "apple"); trie.insert("bat", "bat"); trie.insert("ape", "ape"); trie.insert("bath", "bath"); trie.insert("banana", "banana"); assertEquals(trie.find("apple"), "apple"); assertEquals(trie.find("bat"), "bat"); assertEquals(trie.find("ape"), "ape"); assertEquals(trie.find("bath"), "bath"); assertEquals(trie.find("banana"), "banana"); }
@Test public void testDuplicatesNotAllowed() { RadixTreeImpl<String> trie = new RadixTreeImpl<String>(); trie.insert("apple", "apple"); try { trie.insert("apple", "apple2"); fail("Duplicate should not have been allowed"); } catch (DuplicateKeyException e) { assertEquals("Duplicate key: 'apple'", e.getMessage()); } }