@Test
public void startsWith() throws BufferException {

    ByteBuffer buffer = createCircledByteBuffer(TEST_BYTES1.length);
    buffer.add(TEST_BYTES1);
    Assert.assertEquals(true, buffer.startsWith(TEST_H));
    Assert.assertEquals(true, buffer.startsWith(TEST_HELLO));
    Assert.assertEquals(false, buffer.startsWith(TEST_WORLD));
    Assert.assertEquals(false, buffer.startsWith(TEST_W));
    buffer.clear();
    buffer.add(TEST_WORLD);
    Assert.assertEquals(false, buffer.startsWith(TEST_H));
    Assert.assertEquals(false, buffer.startsWith(TEST_HELLO));
    Assert.assertEquals(true, buffer.startsWith(TEST_WORLD));
    Assert.assertEquals(true, buffer.startsWith(TEST_W));
    buffer.clear();
    buffer.add(TEST_HELLO);
    Assert.assertEquals(true, buffer.startsWith(TEST_H));
    Assert.assertEquals(true, buffer.startsWith(TEST_HELLO));
    // test a longer buffer that does start with the same buffer
    Assert.assertEquals(false, buffer.startsWith(TEST_BYTES1));
}