TreeSet set = new TreeSet();
for (int i = 0, len = words.length; i < len; ++i) {
set.add(words[i]);
}
WordResolver wr = WordResolver.constructInstance(set);
assertEquals(wr.size(), set.size());
Iterator it = set.iterator();
// Let's first check if words that should be there, are:
while (it.hasNext()) {
String str = (String) it.next();
assertEquals(str, wr.find(str));
// And then, let's make sure intern()ing isn't needed:
assertEquals(str, wr.find(""+str));
char[] strArr = str.toCharArray();
char[] strArr2 = new char[strArr.length + 4];
System.arraycopy(strArr, 0, strArr2, 3, strArr.length);
assertEquals(str, wr.find(strArr, 0, str.length()));
assertEquals(str, wr.find(strArr2, 3, str.length() + 3));
}
// And then that ones shouldn't be there aren't:
for (int i = 0, len = missingWords.length; i < len; ++i) {
checkNotFind(wr, missingWords[i]);