@Test(expected=BufferIsFullException.class)
public void addToCauseBufferIsFullException() throws BufferException {

    ByteBuffer buffer = new ByteBuffer(5);
    // append 5 bytes
    for (int i = 0; i < 5; i++)
        buffer.add((byte)10);
    // this should trigger an exception
    buffer.add((byte)11);
}