public static OffsetAndMetadata fromRecord(
        long recordOffset,
        OffsetCommitValue record
    ) {
        return new OffsetAndMetadata(
            recordOffset,
            record.offset(),
            ofSentinel(record.leaderEpoch()),
            record.metadata(),
            record.commitTimestamp(),
            ofSentinel(record.expireTimestamp())
        );
    }
@Test
    public void testFromRecord() {
        OffsetCommitValue record = new OffsetCommitValue()
            .setOffset(100L)
            .setLeaderEpoch(-1)
            .setMetadata("metadata")
            .setCommitTimestamp(1234L)
            .setExpireTimestamp(-1L);

        assertEquals(new OffsetAndMetadata(
            10L,
            100L,
            OptionalInt.empty(),
            "metadata",
            1234L,
            OptionalLong.empty()
        ), OffsetAndMetadata.fromRecord(10L, record));

        record
            .setLeaderEpoch(12)
            .setExpireTimestamp(5678L);

        assertEquals(new OffsetAndMetadata(
            11L,
            100L,
            OptionalInt.of(12),
            "metadata",
            1234L,
            OptionalLong.of(5678L)
        ), OffsetAndMetadata.fromRecord(11L, record));
    }