@Test
void testNullPaddedEmptyString() {

    StringPaddingHandler nullPadded = new NullPadded();
    ByteBuffer byteBuffer = ByteBuffer.allocate(4);
    // consists of nulls
    for (int i = 0; i < byteBuffer.capacity(); i++) {
        byteBuffer.put(Constants.NULL);
    }
    byteBuffer.rewind();
    assertThat(byteBuffer.limit(), is(4)); // length of buffer
    nullPadded.setBufferLimit(byteBuffer);
    assertThat(byteBuffer.limit(), is(0)); // string is empty
    // Read the string back and check the value
    assertThat(US_ASCII.decode(byteBuffer).toString(), is(""));
}