assertTrue(count==1000);
}
@Test
public void testSpellPossibilityIterator() throws Exception {
PossibilityIterator iter = new PossibilityIterator(suggestions, 1000, 10000);
int count = 0;
while (iter.hasNext()) {
RankedSpellPossibility rsp = iter.next();
if(count==0) {
assertTrue("I".equals(rsp.getCorrections().get(0).getCorrection()));
assertTrue("alpha".equals(rsp.getCorrections().get(1).getCorrection()));
assertTrue("one".equals(rsp.getCorrections().get(2).getCorrection()));
}
count++;
}
assertTrue(("Three maps (8*9*10) should return 720 iterations but instead returned " + count), count == 720);
suggestions.remove(new Token("CEE", 0, 2));
iter = new PossibilityIterator(suggestions, 100, 10000);
count = 0;
while (iter.hasNext()) {
iter.next();
count++;
}
assertTrue(("Two maps (8*9) should return 72 iterations but instead returned " + count), count == 72);
suggestions.remove(new Token("BEE", 0, 2));
iter = new PossibilityIterator(suggestions, 5, 10000);
count = 0;
while (iter.hasNext()) {
iter.next();
count++;
}
assertTrue(("We requested 5 suggestions but got " + count), count == 5);
suggestions.remove(new Token("AYE", 0, 2));
iter = new PossibilityIterator(suggestions, Integer.MAX_VALUE, 10000);
count = 0;
while (iter.hasNext()) {
iter.next();
count++;
}
assertTrue(("No maps should return 0 iterations but instead returned " + count), count == 0);
}