@Test
void testNullTerminated() {

    StringPaddingHandler nullTerminated = new StringData.NullTerminated();
    ByteBuffer byteBuffer = ByteBuffer.allocate(20);
    byteBuffer.put("hello".getBytes(US_ASCII));
    byteBuffer.put(Constants.NULL); // Null terminate it
    byteBuffer.put("again".getBytes(US_ASCII)); // This should be cropped off because its after a null
    byteBuffer.rewind();
    assertThat(byteBuffer.limit(), is(20)); // length of buffer
    nullTerminated.setBufferLimit(byteBuffer);
    assertThat(byteBuffer.limit(), is(5)); // hello is 5 chars
    // Read the string back and check the value
    assertThat(US_ASCII.decode(byteBuffer).toString(), is("hello"));
}