@Test
void testSpacePadded() {

    StringPaddingHandler spacePadded = new SpacePadded();
    ByteBuffer byteBuffer = ByteBuffer.allocate(20);
    byteBuffer.put("hello again         ".getBytes(US_ASCII)); // space in the middle and at the end
    byteBuffer.rewind();
    assertThat(byteBuffer.limit(), is(20)); // length of buffer
    spacePadded.setBufferLimit(byteBuffer);
    assertThat(byteBuffer.limit(), is(11)); // "hello again" is 11 chars
    // Read the string back and check the value
    assertThat(US_ASCII.decode(byteBuffer).toString(), is("hello again"));
}