private void checkSerde(OffsetAndMetadata offsetAndMetadata) throws IOException, ClassNotFoundException {
        byte[] bytes =  Serializer.serialize(offsetAndMetadata);
        OffsetAndMetadata deserialized = (OffsetAndMetadata) Serializer.deserialize(bytes);
        assertEquals(offsetAndMetadata, deserialized);
    }
This test case ensures OffsetAndMetadata class is serializable and is serialization compatible.
Note: this ensures that the current code can deserialize data serialized with older versions of the code, but not the reverse.
That is, older code won't necessarily be able to deserialize data serialized with newer code.
clients/src/test/java/org/apache/kafka/clients/consumer/OffsetAndMetadataTest.java