### Question:
KeyValueStoreFile implements Closeable { static void readKeyValuePair( PageCursor cursor, int offset, WritableBuffer key, WritableBuffer value ) throws IOException { long retriesLeft = MAX_LOOKUP_RETRY_COUNT; do { cursor.setOffset( offset ); key.getFrom( cursor ); value.getFrom( cursor ); } while ( cursor.shouldRetry() && (--retriesLeft) > 0 ); if ( cursor.checkAndClearBoundsFlag() ) { throwOutOfBounds( cursor, offset ); } if ( retriesLeft == 0 ) { throwFailedRead( cursor, offset ); } } KeyValueStoreFile( PagedFile file, int keySize, int valueSize, Metadata metadata ); Headers headers(); boolean scan( SearchKey search, KeyValueVisitor visitor ); DataProvider dataProvider(); void scan( KeyValueVisitor visitor ); int entryCount(); @Override void close(); @Override String toString();  }### Answer:
@Test public void shouldFailAfterEnoughAttempts() throws IOException { WritableBuffer buffer = mock( WritableBuffer.class ); PageCursor cursor = mock( PageCursor.class ); when( cursor.shouldRetry() ).thenReturn( true ); when( cursor.getCurrentFile() ).thenReturn( new File( "foo/bar.a" ) ); exception.expect( UnderlyingStorageException.class ); KeyValueStoreFile.readKeyValuePair( cursor, 42, buffer, buffer ); }