### Question:
EntryCursor implements IOCursor<EntryRecord> { @Override public boolean next() throws IOException { currentIndex++; if ( segmentRange == null || currentIndex >= limit ) { if ( !nextSegment() ) { return false; } } if ( cursor.next() ) { currentRecord.set( cursor.get() ); return true; } currentRecord.invalidate(); return false; } EntryCursor( Segments segments, long logIndex ); @Override boolean next(); @Override void close(); @Override EntryRecord get();  }### Answer:
@Test public void ifFileExistsButEntryDoesNotExist() throws Exception { segments.rotate( -1, -1, -1 ); segments.rotate( 10, 10, 10 ); segments.last().closeWriter(); EntryCursor entryCursor = new EntryCursor( segments, 1L ); boolean next = entryCursor.next(); assertFalse( next ); }
@Test public void requestedSegmentHasBeenPruned() throws Exception { segments.rotate( -1, -1, -1 ); segments.rotate( 10, 10, 10 ); segments.rotate( 20, 20, 20 ); segments.prune( 12 ); segments.last().closeWriter(); EntryCursor entryCursor = new EntryCursor( segments, 1L ); boolean next = entryCursor.next(); assertFalse( next ); }
@Test public void requestedSegmentHasNotExistedYet() throws Exception { segments.rotate( -1, -1, -1 ); segments.rotate( 10, 10, 10 ); segments.rotate( 20, 20, 20 ); segments.last().closeWriter(); EntryCursor entryCursor = new EntryCursor( segments, 100L ); boolean next = entryCursor.next(); assertFalse( next ); }