@Test
public void testGetOutOfBounds() throws Exception {
int bytesLen = 100;
byte[] bytes = TestUtils.randomByteArray(bytesLen);
Buffer b = Buffer.buffer(bytes);
assertIndexOutOfBoundsException(() -> b.getByte(bytesLen));
assertIndexOutOfBoundsException(() -> b.getByte(bytesLen + 1));
assertIndexOutOfBoundsException(() -> b.getByte(bytesLen + 100));
assertIndexOutOfBoundsException(() -> b.getByte(-1));
assertIndexOutOfBoundsException(() -> b.getByte(-100));
assertIndexOutOfBoundsException(() -> b.getInt(bytesLen));
assertIndexOutOfBoundsException(() -> b.getInt(bytesLen + 1));
assertIndexOutOfBoundsException(() -> b.getInt(bytesLen + 100));
assertIndexOutOfBoundsException(() -> b.getInt(-1));
assertIndexOutOfBoundsException(() -> b.getInt(-100));
assertIndexOutOfBoundsException(() -> b.getLong(bytesLen));
assertIndexOutOfBoundsException(() -> b.getLong(bytesLen + 1));
assertIndexOutOfBoundsException(() -> b.getLong(bytesLen + 100));
assertIndexOutOfBoundsException(() -> b.getLong(-1));
assertIndexOutOfBoundsException(() -> b.getLong(-100));
assertIndexOutOfBoundsException(() -> b.getFloat(bytesLen));
assertIndexOutOfBoundsException(() -> b.getFloat(bytesLen + 1));
assertIndexOutOfBoundsException(() -> b.getFloat(bytesLen + 100));
assertIndexOutOfBoundsException(() -> b.getFloat(-1));
assertIndexOutOfBoundsException(() -> b.getFloat(-100));
assertIndexOutOfBoundsException(() -> b.getDouble(bytesLen));
assertIndexOutOfBoundsException(() -> b.getDouble(bytesLen + 1));
assertIndexOutOfBoundsException(() -> b.getDouble(bytesLen + 100));
assertIndexOutOfBoundsException(() -> b.getDouble(-1));
assertIndexOutOfBoundsException(() -> b.getDouble(-100));
assertIndexOutOfBoundsException(() -> b.getShort(bytesLen));
assertIndexOutOfBoundsException(() -> b.getShort(bytesLen + 1));
assertIndexOutOfBoundsException(() -> b.getShort(bytesLen + 100));
assertIndexOutOfBoundsException(() -> b.getShort(-1));
assertIndexOutOfBoundsException(() -> b.getShort(-100));
assertIndexOutOfBoundsException(() -> b.getBytes(bytesLen + 1, bytesLen + 1));
assertIndexOutOfBoundsException(() -> b.getBytes(bytesLen + 100, bytesLen + 100));
assertIndexOutOfBoundsException(() -> b.getBytes(-1, -1));
assertIndexOutOfBoundsException(() -> b.getBytes(-100, -100));
assertIndexOutOfBoundsException(() -> b.getString(-1, bytesLen));
assertIndexOutOfBoundsException(() -> b.getString(0, bytesLen + 1));
assertIllegalArgumentException(() -> b.getString(2, 1));
assertIndexOutOfBoundsException(() -> b.getString(-1, bytesLen, "UTF-8"));
assertIndexOutOfBoundsException(() -> b.getString(0, bytesLen + 1, "UTF-8"));
assertIllegalArgumentException(() -> b.getString(2, 1, "UTF-8"));
}