/* * iterator() */ @Test public void test_iterator() throws Exception { MemoryLexicon lexicon = new MemoryLexicon(); assertNotNull(lexicon); for (int i = 0; i < 10; i++) lexicon.term(terms[i].toString(), entries[i]); Iterator<Entry<String, LexiconEntry>> it = lexicon.iterator(); assertNotNull(it); int i = 0; while (it.hasNext()) { Entry<String, LexiconEntry> kv1 = it.next(); Entry<String, LexiconEntry> kv2 = lexicon.getLexiconEntry(i++); assertEquals(kv1.getKey(), kv2.getKey()); assertEquals(kv1.getValue().getTermId(), kv2.getValue().getTermId()); assertEquals(kv1.getValue().getDocumentFrequency(), kv2.getValue().getDocumentFrequency()); assertEquals(kv1.getValue().getFrequency(), kv2.getValue().getFrequency()); } }