/*
  * getLexiconEntry(String term)
  */
 @Test
 public void test_getLexiconEntry1() throws Exception {
   MemoryLexicon lexicon = new MemoryLexicon();
   assertNotNull(lexicon);
   for (int i = 0; i < 10; i++) lexicon.term(terms[i].toString(), entries[i]);
   for (int i = 0; i < 10; i++) {
     LexiconEntry le = lexicon.getLexiconEntry(terms[i].toString());
     assertEquals(i, le.getTermId());
     assertEquals(i + 1, le.getDocumentFrequency());
     assertEquals(i + 1, le.getFrequency());
   }
 }
 /*
  * getLexiconEntry(int termid)
  */
 @Test
 public void test_getLexiconEntry2() throws Exception {
   MemoryLexicon lexicon = new MemoryLexicon();
   assertNotNull(lexicon);
   for (int i = 0; i < 10; i++) lexicon.term(terms[i].toString(), entries[i]);
   for (int i = 0; i < 10; i++) {
     Entry<String, LexiconEntry> kv = lexicon.getLexiconEntry(i);
     assertEquals("t" + i, kv.getKey());
     assertEquals(i, kv.getValue().getTermId());
     assertEquals(i + 1, kv.getValue().getDocumentFrequency());
     assertEquals(i + 1, kv.getValue().getFrequency());
   }
 }
 /*
  * 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());
   }
 }