@Test
public void testAppendTextDataSegmentToStringBuffer () {

    ByteBuffer stringBuffer = ByteBuffer.allocate(32);
    String hello = "hello world";
    stringBuffer.put(hello.getBytes());
    StringBuilder builder = new StringBuilder("...");
    ReadWrite.appendTextDataSegmentToStringBuffer(stringBuffer, builder);
    stringBuffer.clear();
    stringBuffer.put(hello.getBytes());
    Assert.assertEquals(builder.toString(), new StringBuilder("...").append(new String(stringBuffer.array())).toString());
}