### Question:
RegexTrie { public boolean contains(final String string) { Node current = root; final int length = string.length(); for (int i = 0; i < length; i++) { current = current.next.get(string.charAt(i)); if (current == null) { return false; } } return current.terminator; } RegexTrie();  RegexTrie(List<String> strings);  RegexTrie(String... strings); void addAll(List<String> strings); void add(String string); boolean contains(final String string); String toRegex();  }### Answer:
@Test public void testTrie() { String[] strings = new String[] {"", "A", "AB", "ABCDEF", "BC", "BB"}; String[] other = new String[] {"AA", "B", "BBB", "BCB", "ABC", "ABCD", "ABCDE", "ABCDEFF", "C"}; RegexTrie trie = new RegexTrie(Arrays.asList(strings)); for (String string : strings) { Assert.assertTrue(trie.contains(string)); } for (String string : other) { Assert.assertFalse(trie.contains(string)); } }