### Question:
PartitionedOutputBuffer implements OutputBuffer { @Override public long getPeakMemoryUsage() { return memoryManager.getPeakMemoryUsage(); } PartitionedOutputBuffer(
            String taskInstanceId,
            StateMachine<BufferState> state,
            OutputBuffers outputBuffers,
            DataSize maxBufferSize,
            Supplier<LocalMemoryContext> systemMemoryContextSupplier,
            Executor notificationExecutor); @Override void addStateChangeListener(StateChangeListener<BufferState> stateChangeListener); @Override boolean isFinished(); @Override double getUtilization(); @Override boolean isOverutilized(); @Override OutputBufferInfo getInfo(); @Override void setOutputBuffers(OutputBuffers newOutputBuffers); @Override ListenableFuture<?> isFull(); @Override void enqueue(List<SerializedPage> pages); @Override void enqueue(int partitionNumber, List<SerializedPage> pages); @Override ListenableFuture<BufferResult> get(OutputBufferId outputBufferId, long startingSequenceId, DataSize maxSize); @Override void acknowledge(OutputBufferId outputBufferId, long sequenceId); @Override void abort(OutputBufferId bufferId); @Override void setNoMorePages(); @Override void destroy(); @Override void fail(); @Override long getPeakMemoryUsage();  }### Answer:
@Test public void testBufferPeakMemoryUsage() { PartitionedOutputBuffer buffer = createPartitionedBuffer( createInitialEmptyOutputBuffers(PARTITIONED) .withBuffer(FIRST, 0) .withNoMoreBufferIds(), sizeOfPages(5)); Page page = createPage(1); long serializePageSize = PAGES_SERDE.serialize(page).getRetainedSizeInBytes(); for (int i = 0; i < 5; i++) { addPage(buffer, page, 0); assertEquals(buffer.getPeakMemoryUsage(), (i + 1) * serializePageSize); } }