@Test
    public void testInvalidNegativeOffset() {
        assertThrows(IllegalArgumentException.class, () -> new OffsetAndMetadata(-239L, Optional.of(15), ""));
    }
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