### Question:
EntryIndexFile implements Iterable<EntryIndexItem> { public void appendEntryIndex(int index, long offset, int kind, int term) throws IOException { if (seekableFile.size() == 0L) { seekableFile.writeInt(index); minEntryIndex = index; } else { if (index != maxEntryIndex + 1) { throw new IllegalArgumentException("index must be " + (maxEntryIndex + 1) + ", but was " + index); } seekableFile.seek(OFFSET_MAX_ENTRY_INDEX); } seekableFile.writeInt(index); maxEntryIndex = index; updateEntryIndexCount(); seekableFile.seek(getOffsetOfEntryIndexItem(index)); seekableFile.writeLong(offset); seekableFile.writeInt(kind); seekableFile.writeInt(term); entryIndexMap.put(index, new EntryIndexItem(index, offset, kind, term)); } 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 testAppendEntryIndex() throws IOException { ByteArraySeekableFile seekableFile = new ByteArraySeekableFile(); EntryIndexFile file = new EntryIndexFile(seekableFile); file.appendEntryIndex(10, 100L, 1, 2); Assert.assertEquals(1, file.getEntryIndexCount()); Assert.assertEquals(10, file.getMinEntryIndex()); Assert.assertEquals(10, file.getMaxEntryIndex()); seekableFile.seek(0L); Assert.assertEquals(10, seekableFile.readInt()); Assert.assertEquals(10, seekableFile.readInt()); Assert.assertEquals(100L, seekableFile.readLong()); Assert.assertEquals(1, seekableFile.readInt()); Assert.assertEquals(2, seekableFile.readInt()); EntryIndexItem item = file.get(10); Assert.assertNotNull(item); Assert.assertEquals(100L, item.getOffset()); Assert.assertEquals(1, item.getKind()); Assert.assertEquals(2, item.getTerm()); file.appendEntryIndex(11, 200L, 1, 2); Assert.assertEquals(2, file.getEntryIndexCount()); Assert.assertEquals(10, file.getMinEntryIndex()); Assert.assertEquals(11, file.getMaxEntryIndex()); seekableFile.seek(24L); Assert.assertEquals(200L, seekableFile.readLong()); Assert.assertEquals(1, seekableFile.readInt()); Assert.assertEquals(2, seekableFile.readInt()); }