void doByteBufferModificationTest(final T inputObject,
                                      final T expectedOutputObject,
                                      final Supplier<S> serdeSupplier,
                                      final BiConsumer<S, ByteBuffer> byteBufferModifier) {

        // use two serde instances to be sure ser and de-ser are independent
        final S serde1 = serdeSupplier.get();
        final S serde2 = serdeSupplier.get();

        // allocate a buffer size bigger than we need
        final ByteBuffer byteBuffer = ByteBuffer.allocate(BYTE_BUFFER_SIZE);

        serde1.serialize(byteBuffer, inputObject);

        // modify the bytebuffer
        byteBufferModifier.accept(serde1, byteBuffer);

        T outputObject = serde2.deserialize(byteBuffer);

        LOGGER.debug("inputObject [{}]", inputObject);
        LOGGER.debug("expectedOutputObject [{}]", expectedOutputObject);
        LOGGER.debug("outputObject [{}]", outputObject);

        assertThat(outputObject).isEqualTo(expectedOutputObject);

        T outputObject2 = serde2.deserialize(byteBuffer);

        // re-run the deser to ennsure the buffer is in the right position to be read from again
        assertThat(outputObject2).isEqualTo(expectedOutputObject);
    }
Assumes a no-arg ctor, override if serde doesn't have one.
stroom-pipeline/src/test/java/stroom/pipeline/refdata/store/offheapstore/serdes/AbstractSerdeTest.java