@Test
public void twoShardTest() throws IOException {

  // GIVEN
  ByteBuffer buf1 = ByteBuffer.wrap(new byte[] { 1, 2, 3, 4, 5 });
  ByteBuffer buf2 = ByteBuffer.wrap(new byte[] { 11, 12, 13, 14, 15 });
  try (BigByteBuffer buf = new BigByteBuffer(new ByteBuffer[] { buf1, buf2 })) {
    // WHEN THEN
    Assert.assertEquals(1, buf.get(0));
    Assert.assertEquals(5, buf.get(4));
    Assert.assertEquals(11, buf.get(5));
    Assert.assertEquals(15, buf.get(9));
    byte[] tmp = new byte[5];
    buf.get(0, tmp, 0, 5);
    Assert.assertEquals(new byte[] { 1, 2, 3, 4, 5 }, tmp);
    tmp = new byte[5];
    buf.get(5, tmp, 0, 5);
    Assert.assertEquals(new byte[] { 11, 12, 13, 14, 15 }, tmp);
    tmp = new byte[2];
    buf.get(4, tmp, 0, 2);
    Assert.assertEquals(new byte[] { 5, 11 }, tmp);
    tmp = new byte[10];
    buf.get(0, tmp, 0, 10);
    Assert.assertEquals(new byte[] { 1, 2, 3, 4, 5, 11, 12, 13, 14, 15 }, tmp);
    tmp = new byte[9];
    buf.get(1, tmp, 0, 9);
    Assert.assertEquals(new byte[] { 2, 3, 4, 5, 11, 12, 13, 14, 15 }, tmp);
    tmp = new byte[11];
    tmp[0] = 0;
    buf.get(0, tmp, 1, 10);
    Assert.assertEquals(new byte[] { 0, 1, 2, 3, 4, 5, 11, 12, 13, 14, 15 }, tmp);
  }
}