### Question:
LedgerEntriesImpl implements LedgerEntries { @Override public LedgerEntry getEntry(long entryId) { checkNotNull(entries, "entries has been recycled"); long firstId = entries.get(0).getEntryId(); long lastId = entries.get(entries.size() - 1).getEntryId(); if (entryId < firstId || entryId > lastId) { throw new IndexOutOfBoundsException("required index: " + entryId + " is out of bounds: [ " + firstId + ", " + lastId + " ]."); } return entries.get((int) (entryId - firstId)); } private  LedgerEntriesImpl(Recycler.Handle<LedgerEntriesImpl> recyclerHandle); static LedgerEntriesImpl create(List<LedgerEntry> entries); @Override LedgerEntry getEntry(long entryId); @Override Iterator<LedgerEntry> iterator(); @Override void close();  }### Answer:
@Test public void testGetEntry() { for (int i = 0; i < entryNumber; i++) { LedgerEntry entry = ledgerEntriesImpl.getEntry(entryId + i); assertEquals(entryList.get(i).getLedgerId(), entry.getLedgerId()); assertEquals(entryList.get(i).getEntryId(), entry.getEntryId()); assertEquals(entryList.get(i).getLength(), entry.getLength()); ByteBuf buf = entry.getEntryBuffer(); byte[] content = new byte[buf.readableBytes()]; buf.readBytes(content); assertArrayEquals(dataBytes, content); assertEquals(1, entry.getEntryBuffer().refCnt()); } try { LedgerEntry entry = ledgerEntriesImpl.getEntry(entryId - 1); fail("Should get IndexOutOfBoundsException"); } catch (IndexOutOfBoundsException e) { } try { LedgerEntry entry = ledgerEntriesImpl.getEntry(entryId + entryNumber); fail("Should get IndexOutOfBoundsException"); } catch (IndexOutOfBoundsException e) { } }