T doSerialisationDeserialisationTest(T object, Supplier<Serde<T>> serdeSupplier) {
        // use two serde instances to be sure ser and de-ser are independent
        final Serde<T> serde1 = serdeSupplier.get();
        final Serde<T> serde2 = serdeSupplier.get();

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

        serde1.serialize(byteBuffer, object);

        LOGGER.debug(ByteBufferUtils.byteBufferInfo(byteBuffer));

        T object2 = serde2.deserialize(byteBuffer);

        LOGGER.debug("Object   [{}]", object);
        LOGGER.debug("Object 2 [{}]", object2);

        assertThat(object2).isEqualTo(object);

        T object3 = serde2.deserialize(byteBuffer);

        // re-run the deser to ensure the buffer is in the right position to be read from again
        assertThat(object3).isEqualTo(object);

        // ensure hashcode work across ser-deser
        assertThat(object.hashCode()).isEqualTo(object2.hashCode());
        assertThat(object.hashCode()).isEqualTo(object3.hashCode());

        return object2;
    }
Assumes a no-arg ctor, override if serde doesn't have one.
stroom-lmdb/src/test/java/stroom/lmdb/serde/AbstractSerdeTest.java