### Question:
EntryIndexFile implements Iterable<EntryIndexItem> { @Override @Nonnull public Iterator<EntryIndexItem> iterator() { if (isEmpty()) { return Collections.emptyIterator(); } return new EntryIndexIterator(entryIndexCount, minEntryIndex); } EntryIndexFile(File file);  EntryIndexFile(SeekableFile seekableFile); boolean isEmpty(); int getMinEntryIndex(); int getMaxEntryIndex(); int getEntryIndexCount(); void appendEntryIndex(int index, long offset, int kind, int term); void clear(); void removeAfter(int newMaxEntryIndex); long getOffset(int entryIndex); @Nonnull EntryIndexItem get(int entryIndex); @Override @Nonnull Iterator<EntryIndexItem> iterator(); void close();  }### Answer:
@Test public void testIteratorEmpty() throws IOException { EntryIndexFile file = new EntryIndexFile(new ByteArraySeekableFile()); Iterator<EntryIndexItem> iterator = file.iterator(); Assert.assertFalse(iterator.hasNext()); }
@Test public void testIterator() throws IOException { EntryIndexFile file = new EntryIndexFile(makeEntryIndexFileContent(3, 4)); Iterator<EntryIndexItem> iterator = file.iterator(); Assert.assertTrue(iterator.hasNext()); EntryIndexItem item = iterator.next(); Assert.assertEquals(3, item.getIndex()); Assert.assertEquals(1, item.getKind()); Assert.assertEquals(3, item.getTerm()); Assert.assertTrue(iterator.hasNext()); item = iterator.next(); Assert.assertEquals(4, item.getIndex()); Assert.assertFalse(iterator.hasNext()); }