@Override
    public OffsetFetchResponseData data() {
        return data;
    }
@Test
    public void testNullableMetadataV0ToV7() {
        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, Errors.GROUP_AUTHORIZATION_FAILED, partitionDataMap);
        OffsetFetchResponseData expectedData =
            new OffsetFetchResponseData()
                .setErrorCode(Errors.GROUP_AUTHORIZATION_FAILED.code())
                .setThrottleTimeMs(throttleTimeMs)
                .setTopics(Collections.singletonList(
                    new OffsetFetchResponseTopic()
                        .setName(topicOne)
                        .setPartitions(Collections.singletonList(
                            new OffsetFetchResponsePartition()
                                .setPartitionIndex(partitionOne)
                                .setCommittedOffset(offset)
                                .setCommittedLeaderEpoch(leaderEpochOne.orElse(-1))
                                .setErrorCode(Errors.UNKNOWN_TOPIC_OR_PARTITION.code())
                                .setMetadata(null))
                        ))
                );
        assertEquals(expectedData, response.data());
    }