@Test
public void toArrayWithOffsetLengthCapacity() throws BufferException {

    ByteBuffer buffer = new ByteBuffer(TEST_BYTES1);
    byte[] copyArray = buffer.toArray(3, 1, 1);
    Assert.assertArrayEquals(this.TEST_L, copyArray);
    copyArray = buffer.toArray(5, 2, 2);
    Assert.assertArrayEquals(this.TEST_SPACEW, copyArray);
    copyArray = buffer.toArray(10, 1, 4);
    byte[] tmp = new byte[4];
    tmp[0] = (byte)'D';
    Assert.assertArrayEquals(tmp, copyArray);
    Assert.assertEquals(4, copyArray.length);
}