@Test
  public void testNegativeBlockTime() throws Exception {
    final int size = 1024;
    final long capacity = 1024;
    final long maxBlockTimeInMs = 20;
    SimpleByteBufferPool pool = new SimpleByteBufferPool(capacity);
    ByteBuffer buffer = pool.allocate(size, 0);
    pool.deallocate(buffer);
    try {
      pool.allocate(size, -maxBlockTimeInMs);
      fail("IllegalArgumentException should have been thrown when timeToBlockInMs is negative.");
    } catch (IllegalArgumentException e) {
    }
    try {
      pool.allocate((int) capacity + 1, maxBlockTimeInMs);
      fail(
          "IllegalArgumentException should have been thrown when requested buffer size is larger than the buffer pool's capacity.");
    } catch (IllegalArgumentException e) {
    }
    assertEquals(size, pool.capacity());
  }
This test ensures that the {@link SimpleByteBufferPool} behaves correctly when the {@code timeToBlockInMs}
parameter set in {@link SimpleByteBufferPool#allocate(int, long)} is zero or a negative value.
ambry-utils/src/test/java/com/github/ambry/utils/SimpleByteBufferPoolTest.java