public static OffsetCommitResponseData getErrorResponse(
        OffsetCommitRequestData request,
        Errors error
    ) {
        OffsetCommitResponseData response = new OffsetCommitResponseData();
        request.topics().forEach(topic -> {
            OffsetCommitResponseTopic responseTopic = new OffsetCommitResponseTopic()
                .setName(topic.name());
            response.topics().add(responseTopic);

            topic.partitions().forEach(partition ->
                responseTopic.partitions().add(new OffsetCommitResponsePartition()
                    .setPartitionIndex(partition.partitionIndex())
                    .setErrorCode(error.code()))
            );
        });
        return response;
    }
@Test
    public void testGetErrorResponse() {
        OffsetCommitResponseData expectedResponse = new OffsetCommitResponseData()
            .setTopics(Arrays.asList(
                new OffsetCommitResponseTopic()
                    .setName(topicOne)
                    .setPartitions(Collections.singletonList(
                        new OffsetCommitResponsePartition()
                            .setErrorCode(Errors.UNKNOWN_MEMBER_ID.code())
                            .setPartitionIndex(partitionOne))),
                new OffsetCommitResponseTopic()
                    .setName(topicTwo)
                    .setPartitions(Collections.singletonList(
                        new OffsetCommitResponsePartition()
                            .setErrorCode(Errors.UNKNOWN_MEMBER_ID.code())
                            .setPartitionIndex(partitionTwo)))));

        assertEquals(expectedResponse, getErrorResponse(data, Errors.UNKNOWN_MEMBER_ID));
    }