### Question:
VariableWidthBlockBuilder extends AbstractVariableWidthBlock implements BlockBuilder { @Override public BlockBuilder newBlockBuilderLike(BlockBuilderStatus blockBuilderStatus) { int currentSizeInBytes = positions == 0 ? positions : (getOffset(positions) - getOffset(0)); return new VariableWidthBlockBuilder(blockBuilderStatus, calculateBlockResetSize(positions), calculateBlockResetBytes(currentSizeInBytes)); } VariableWidthBlockBuilder(@Nullable BlockBuilderStatus blockBuilderStatus, int expectedEntries, int expectedBytes); @Override int getSliceLength(int position); @Override int getPositionCount(); @Override long getSizeInBytes(); @Override long getRegionSizeInBytes(int positionOffset, int length); @Override long getPositionsSizeInBytes(boolean[] positions); @Override long getRetainedSizeInBytes(); @Override void retainedBytesForEachPart(BiConsumer<Object, Long> consumer); @Override Block copyPositions(int[] positions, int offset, int length); @Override BlockBuilder writeByte(int value); @Override BlockBuilder writeShort(int value); @Override BlockBuilder writeInt(int value); @Override BlockBuilder writeLong(long value); @Override BlockBuilder writeBytes(Slice source, int sourceIndex, int length); @Override BlockBuilder closeEntry(); @Override BlockBuilder appendNull(); @Override boolean mayHaveNull(); @Override Block getRegion(int positionOffset, int length); @Override Block copyRegion(int positionOffset, int length); @Override Block build(); @Override BlockBuilder newBlockBuilderLike(BlockBuilderStatus blockBuilderStatus); @Override String toString();  }### Answer:
@Test public void testNewBlockBuilderLike() { int entries = 12345; double resetSkew = 1.25; BlockBuilder blockBuilder = new VariableWidthBlockBuilder(null, entries, entries); for (int i = 0; i < entries; i++) { blockBuilder.writeByte(i); blockBuilder.closeEntry(); } blockBuilder = blockBuilder.newBlockBuilderLike(null); blockBuilder.writeByte(1); long actualArrayBytes = sizeOf(new int[(int) ceil(resetSkew * (entries + 1))]) + sizeOf(new boolean[(int) ceil(resetSkew * entries)]); long actualSliceBytes = SLICE_INSTANCE_SIZE + sizeOf(new byte[(int) ceil(resetSkew * entries)]); assertEquals(blockBuilder.getRetainedSizeInBytes(), BLOCK_BUILDER_INSTANCE_SIZE + actualSliceBytes + actualArrayBytes); }