@Test(expected = IllegalArgumentException.class)
public void testCapacityNegative() {

    ByteBuf buffer = newBuffer(3, 13);
    assertEquals(13, buffer.maxCapacity());
    assertEquals(3, buffer.capacity());
    try {
        buffer.capacity(-1);
    } finally {
        buffer.release();
    }
}