@@ -0,0 +1,1872 @@
+package org.mozilla.focus.webkit.matcher;%0A%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mozilla.focus.webkit.matcher.Trie.WhiteListTrie;%0Aimport org.robolectric.RobolectricTestRunner;%0A%0Aimport static org.junit.Assert.*;%0A%0A@RunWith(RobolectricTestRunner.class)%0Apublic class TrieTest %7B%0A%0A    @Test%0A    public void findNode() throws Exception %7B%0A        final Trie trie = Trie.createRootNode();%0A%0A        assertNull(trie.findNode(%22hello%22));%0A%0A        final Trie putNode = trie.put(%22hello%22);%0A        final Trie foundNode = trie.findNode(%22hello%22);%0A%0A        assertNotNull(putNode);%0A        assertNotNull(foundNode);%0A        assertEquals(putNode, foundNode);%0A%0A        // Substring matching: only works in one direction%0A        assertNull(trie.findNode(%22hell%22));%0A        assertNotNull(trie.findNode(%22hellohello%22));%0A%0A        trie.put(%22hellohello%22);%0A%0A        // Ensure both old and new overlapping strings can still be found%0A        assertNotNull(trie.findNode(%22hello%22));%0A        assertNotNull(trie.findNode(%22hellohello%22));%0A        assertNull(trie.findNode(%22hell%22));%0A        assertNull(trie.findNode(%22hella%22));%0A    %7D%0A%0A    @Test%0A    public void testWhiteListTrie() %7B%0A        final WhiteListTrie trie;%0A%0A        %7B%0A            final Trie whitelist = Trie.createRootNode();%0A%0A            whitelist.put(%22abc%22);%0A%0A            trie = WhiteListTrie.createRootNode();%0A            trie.putWhiteList(%22def%22, whitelist);%0A        %7D%0A%0A        assertNull(trie.findNode(%22abc%22));%0A%0A        // In practice EntityList uses it's own search in order to cover all possible matching notes%0A        // (e.g. in case we have separate whitelists for mozilla.org and foo.mozilla.org), however%0A        // we don't need to test that here yet.%0A        final Trie foundWhitelist = trie.findNode(%22def%22);%0A        assertNotNull(foundWhitelist);%0A%0A        assertNotNull(foundWhitelist.findNode(%22abc%22));%0A    %7D%0A%7D

Add some basic tests for our Trie