### Question:
Trie { public boolean insertWord(String s) { if (s == null) { throw new IllegalArgumentException("Input string is null"); } TrieNode node = parent; for (int i = 0; i < s.length(); i++) { node = node.getChild(s.charAt(i)); } if (node.endOfWord) { return false; } node.endOfWord = true; size++; return true; } Trie(); boolean insertWord(String s); boolean containsWord(String s); boolean containsAsPrefix(String s); boolean containsPrefixOf(String s); int getSize();  }### Answer:
@Test(expected = IllegalArgumentException.class) public void testInsertWordWithNull() { Trie trie = new Trie(); trie.insertWord(null); }
@Test(expected = IllegalArgumentException.class) public void testInsertWordIncorrectChar1() { Trie trie = new Trie(); trie.insertWord("cash$"); }
@Test(expected = IllegalArgumentException.class) public void testInsertWordIncorrectChar2() { Trie trie = new Trie(); trie.insertWord("Two words"); }
@Test(expected = IllegalArgumentException.class) public void testInsertWordIncorrectChar3() { Trie trie = new Trie(); trie.insertWord("Two,words"); }
@Test(expected = IllegalArgumentException.class) public void testInsertWordIncorrectChar4() { Trie trie = new Trie(); trie.insertWord("I am a sentence"); }
@Test public void testInsertWordWithEmpty() { Trie trie = new Trie(); assertTrue("First insertion of empty string to Trie should return true", trie.insertWord("")); }
@Test public void testInsertWordEmptyTwice() { Trie trie = new Trie(); assertTrue("First insertion of empty string to Trie should return true", trie.insertWord("")); assertFalse("Second insertion of empty string to empty Trie should return false", trie.insertWord("")); }
@Test public void testInsertWordUniqueArray() { Trie trie = new Trie(); String[] sequence = new String[]{"a", "", "stv", "aa", "bb", "b", "a9", "aA9"}; for (String element : sequence) { assertTrue("Insertion should be ok", trie.insertWord(element)); } }