@Test
public void testLong() {
for (ByteOrder bo : new ByteOrder[] { ByteOrder.BIG_ENDIAN, ByteOrder.LITTLE_ENDIAN }) {
ByteBuffer bb = (ByteBuffer) ByteBuffer.allocate(9).order(bo).putLong(123456789012l).rewind();
IoBuffer ioBuffer = IoBuffer.wrap(bb).order(bo);
assertEquals(9, ioBuffer.capacity());
ioBuffer.extend(7);
ioBuffer.position(8);
assertEquals(16, ioBuffer.capacity());
ioBuffer.putLong(-23456789023l);
ioBuffer.rewind();
assertEquals(123456789012l, ioBuffer.getLong());
assertEquals(-23456789023l, ioBuffer.getLong());
ioBuffer.rewind();
ioBuffer.putLong(4, 1234567890);
assertEquals(1234567890, ioBuffer.getLong(4));
try {
ioBuffer.putLong(9, 1);
fail("Not enough place on the buffer");
} catch (BufferUnderflowException e) {
}
try {
ioBuffer.getLong(9);
fail("Not enough place on the buffer");
} catch (BufferUnderflowException e) {
}
}
}