### Question:
PropertyValueRecordSizeCalculator implements ToIntFunction<Value[]> { @Override public int applyAsInt( Value[] values ) { stringRecordIds.reset(); arrayRecordIds.reset(); int propertyRecordsUsed = 0; int freeBlocksInCurrentRecord = 0; for ( Value value : values ) { PropertyBlock block = new PropertyBlock(); PropertyStore.encodeValue( block, 0 , value, stringRecordCounter, arrayRecordCounter, true ); if ( block.getValueBlocks().length > freeBlocksInCurrentRecord ) { propertyRecordsUsed++; freeBlocksInCurrentRecord = PropertyType.getPayloadSizeLongs(); } freeBlocksInCurrentRecord -= block.getValueBlocks().length; } int size = propertyRecordsUsed * propertyRecordSize; size += toIntExact( stringRecordIds.peek() ) * stringRecordSize; size += toIntExact( arrayRecordIds.peek() ) * arrayRecordSize; return size; } PropertyValueRecordSizeCalculator( PropertyStore propertyStore );  PropertyValueRecordSizeCalculator( int propertyRecordSize,
            int stringRecordSize, int stringRecordDataSize,
            int arrayRecordSize, int arrayRecordDataSize ); @Override int applyAsInt( Value[] values );  }### Answer:
@Test public void shouldIncludePropertyRecordSize() { PropertyValueRecordSizeCalculator calculator = newCalculator(); int size = calculator.applyAsInt( new Value[] {Values.of( 10 )} ); assertEquals( PropertyRecordFormat.RECORD_SIZE, size ); }
@Test public void shouldIncludeDynamicRecordSizes() { PropertyValueRecordSizeCalculator calculator = newCalculator(); int size = calculator.applyAsInt( new Value[] {Values.of( string( 80 ) ), Values.of( new String[] {string( 150 )} )} ); assertEquals( PROPERTY_RECORD_SIZE + DYNAMIC_RECORD_SIZE + DYNAMIC_RECORD_SIZE * 2, size ); }
@Test public void shouldSpanMultiplePropertyRecords() { PropertyValueRecordSizeCalculator calculator = newCalculator(); int size = calculator.applyAsInt( new Value[] { Values.of( 10 ), Values.of( "test" ), Values.of( (byte) 5 ), Values.of( string( 80 ) ), Values.of( "a bit longer short string" ), Values.of( 1234567890123456789L ), Values.of( 5 ), Values.of( "value" ) } ); assertEquals( PROPERTY_RECORD_SIZE * 3 + DYNAMIC_RECORD_SIZE, size ); }