### Question:
OverlappingCapacityAwareEstimator implements WriteDemandEstimator { protected abstract long getRequestNForCapacity(long capacityToFill); protected  OverlappingCapacityAwareEstimator(SizeEstimator sizeEstimator); @Override final void onItemWrite(Object written, long writeBufferCapacityBeforeWrite,
                                  long writeBufferCapacityAfterWrite); @Override final long estimateRequestN(long writeBufferCapacityInBytes);  }### Answer:
@Test public void testRequestNNoItemWrite() { OverlappingCapacityAwareEstimator supplier = newSupplier(() -> 100); requestNAndVerify(supplier, 10, 100L); verify(supplier).getRequestNForCapacity(10); verifyNoMoreInteractions(supplier); }
@Test public void testPredictionZeroAndNoOutstanding() { AtomicLong toRequest = new AtomicLong(0); OverlappingCapacityAwareEstimator supplier = newSupplier(toRequest::get); requestNAndVerify(supplier, 10, 1L); verify(supplier).getRequestNForCapacity(10); verifyNoMoreInteractions(supplier); }
@Test public void testPredictionZeroAndSomeOutstanding() { AtomicLong toRequest = new AtomicLong(5); OverlappingCapacityAwareEstimator supplier = newSupplier(toRequest::get); requestNAndVerify(supplier, 10, 5L); verify(supplier).getRequestNForCapacity(10); toRequest.set(0); requestNAndVerify(supplier, 10, 0L); verifyNoMoreInteractions(supplier); }