@Test public void testGetAnyWordStartingWith() { ArrayList<String> words = new ArrayList<>(Arrays.asList(wordsArray)); FastDictionary dict = new FastDictionary(words); assertNull(dict.getAnyWordStartingWith("notaword")); assertNull(dict.getAnyWordStartingWith("caq")); assertNotNull(dict.getAnyWordStartingWith("")); assertEquals("catfishes", dict.getAnyWordStartingWith("catfishe")); assertEquals(null, dict.getAnyWordStartingWith("catfishes")); assertTrue(dict.getAnyWordStartingWith("cat").startsWith("cat")); assertEquals("lives", dict.getAnyWordStartingWith("liv")); assertEquals("apple", dict.getAnyWordStartingWith("a")); assertEquals("apple", dict.getAnyWordStartingWith("ap")); assertEquals("apple", dict.getAnyWordStartingWith("app")); assertEquals("apple", dict.getAnyWordStartingWith("appl")); }
@Override public String getAnyWordStartingWith(String prefix) { return root.getAnyWordStartingWith(prefix); }
FastDictionary implements GhostDictionary { @Override public String getAnyWordStartingWith(String prefix) { return root.getAnyWordStartingWith(prefix); } }
FastDictionary implements GhostDictionary { @Override public String getAnyWordStartingWith(String prefix) { return root.getAnyWordStartingWith(prefix); } FastDictionary(InputStream wordListStream); @VisibleForTesting  FastDictionary(List<String> words); }
FastDictionary implements GhostDictionary { @Override public String getAnyWordStartingWith(String prefix) { return root.getAnyWordStartingWith(prefix); } FastDictionary(InputStream wordListStream); @VisibleForTesting  FastDictionary(List<String> words); @Override boolean isWord(String word); @Override String getAnyWordStartingWith(String prefix); @Override String getGoodWordStartingWith(String prefix); }
FastDictionary implements GhostDictionary { @Override public String getAnyWordStartingWith(String prefix) { return root.getAnyWordStartingWith(prefix); } FastDictionary(InputStream wordListStream); @VisibleForTesting  FastDictionary(List<String> words); @Override boolean isWord(String word); @Override String getAnyWordStartingWith(String prefix); @Override String getGoodWordStartingWith(String prefix);  }