@Override
    public OffsetFetchResponseData data() {
        return data;
    }
@Test
    public void testNullableMetadataV8AndAbove() {
        PartitionData pd = new PartitionData(
            offset,
            leaderEpochOne,
            null,
            Errors.UNKNOWN_TOPIC_OR_PARTITION);
        // test PartitionData.equals with null metadata
        assertEquals(pd, pd);
        partitionDataMap.clear();
        partitionDataMap.put(new TopicPartition(topicOne, partitionOne), pd);

        OffsetFetchResponse response = new OffsetFetchResponse(
            throttleTimeMs,
            Collections.singletonMap(groupOne, Errors.GROUP_AUTHORIZATION_FAILED),
            Collections.singletonMap(groupOne, partitionDataMap));
        OffsetFetchResponseData expectedData =
            new OffsetFetchResponseData()
                .setGroups(Collections.singletonList(
                    new OffsetFetchResponseGroup()
                        .setGroupId(groupOne)
                        .setTopics(Collections.singletonList(
                            new OffsetFetchResponseTopics()
                                .setName(topicOne)
                                .setPartitions(Collections.singletonList(
                                    new OffsetFetchResponsePartitions()
                                        .setPartitionIndex(partitionOne)
                                        .setCommittedOffset(offset)
                                        .setCommittedLeaderEpoch(leaderEpochOne.orElse(-1))
                                        .setErrorCode(Errors.UNKNOWN_TOPIC_OR_PARTITION.code())
                                        .setMetadata(null)))))
                        .setErrorCode(Errors.GROUP_AUTHORIZATION_FAILED.code())))
                .setThrottleTimeMs(throttleTimeMs);
        assertEquals(expectedData, response.data());
    }