### Question:
BlockStorage implements Closeable { static long calculateNumberOfEntriesWrittenDuringMerges( long entryCount, long numberOfBlocks, int mergeFactor ) { int singleMerges = 0; for ( long blocks = numberOfBlocks; blocks > 1; blocks = (long) ceil( (double) blocks / mergeFactor ) ) { singleMerges++; } return singleMerges * entryCount; } BlockStorage( Layout<KEY,VALUE> layout, ByteBufferFactory bufferFactory, FileSystemAbstraction fs, File blockFile, Monitor monitor ); void add( KEY key, VALUE value ); void merge( int mergeFactor, Cancellation cancellation ); @Override void close();  }### Answer:
@Test void shouldCalculateCorrectNumberOfEntriesToWriteDuringMerge() { long entryCountForOneBlock = BlockStorage.calculateNumberOfEntriesWrittenDuringMerges( 100, 1, 2 ); long entryCountForMergeFactorBlocks = BlockStorage.calculateNumberOfEntriesWrittenDuringMerges( 100, 4, 4 ); long entryCountForMoreThanMergeFactorBlocks = BlockStorage.calculateNumberOfEntriesWrittenDuringMerges( 100, 5, 4 ); long entryCountForThreeFactorsMergeFactorBlocks = BlockStorage.calculateNumberOfEntriesWrittenDuringMerges( 100, 4 * 4 * 4 - 3, 4 ); assertEquals( 0, entryCountForOneBlock ); assertEquals( 100, entryCountForMergeFactorBlocks ); assertEquals( 200, entryCountForMoreThanMergeFactorBlocks ); assertEquals( 300, entryCountForThreeFactorsMergeFactorBlocks ); }