HashMapDictionaryBuilder dictBuilder = new HashMapDictionaryBuilder();
// create dictionary file parser
DictionaryFileParser fileParser = new DictionaryFileParserImpl();
fileParser.parseDictionaryFile(dictFile.getAbsolutePath(), stream,
dictBuilder);
HashMapDictionary dict = (HashMapDictionary) dictBuilder.getDictionary();
// read dictionary entries
ArrayList<String> entries = getDictionaryEntries(dictFile);
for (int i = 0; i < entries.size(); i++) {
StringTokenizer tokenizer = new StringTokenizer(entries.get(i),
dictBuilder.getMultiWordSeparator());
ArrayList<String> list = new ArrayList<String>();
while (tokenizer.hasMoreTokens()) {
list.add(tokenizer.nextToken());
}
String[] multiWord = list.toArray(new String[] {});
Assert.assertTrue("Missing in dictionary: " + entries.get(i), dict
.contains(multiWord));
}
Assert.assertEquals(4, dict.getEntryCount());
Assert.assertFalse(dict.contains(new String[] { "Unstructured",
"Information", "Management", "Architecture" }));
Assert.assertTrue(dict.contains(new String[] { "new", "yORk" }));
Assert.assertTrue(dict.contains(new String[] { "new", "york", "city" }));
Assert.assertFalse(dict.contains("new"));
}