public ShareGroupDescribeResponseData.Member asShareGroupDescribeMember(
        TopicsImage topicsImage
    ) {
        return new ShareGroupDescribeResponseData.Member()
            .setMemberEpoch(memberEpoch)
            .setMemberId(memberId)
            .setAssignment(new ShareGroupDescribeResponseData.Assignment()
                .setTopicPartitions(topicPartitionsFromMap(assignedPartitions, topicsImage)))
            .setClientHost(clientHost)
            .setClientId(clientId)
            .setRackId(rackId)
            .setSubscribedTopicNames(subscribedTopicNames == null ? null : new ArrayList<>(subscribedTopicNames));
    }
@Test
    public void testAsShareGroupDescribeMember() {
        Uuid topicId1 = Uuid.randomUuid();
        Uuid topicId2 = Uuid.randomUuid();
        MetadataImage metadataImage = new MetadataImageBuilder()
            .addTopic(topicId1, "topic1", 3)
            .addTopic(topicId2, "topic2", 3)
            .build();
        List<String> subscribedTopicNames = Arrays.asList("topic1", "topic2");
        List<Integer> assignedPartitions = Arrays.asList(0, 1, 2);
        int epoch = 10;
        ShareGroupMemberMetadataValue record = new ShareGroupMemberMetadataValue()
            .setClientId("client-id")
            .setClientHost("host-id")
            .setRackId("rack-id")
            .setSubscribedTopicNames(subscribedTopicNames);

        String memberId = Uuid.randomUuid().toString();
        ShareGroupMember member = new ShareGroupMember.Builder(memberId)
            .updateWith(record)
            .setMemberEpoch(epoch)
            .setAssignedPartitions(mkAssignment(
                mkTopicAssignment(topicId1, 0, 1, 2)))
            .build();

        ShareGroupDescribeResponseData.Member actual = member.asShareGroupDescribeMember(metadataImage.topics());
        ShareGroupDescribeResponseData.Member expected = new ShareGroupDescribeResponseData.Member()
            .setMemberId(memberId)
            .setMemberEpoch(epoch)
            .setClientId("client-id")
            .setRackId("rack-id")
            .setClientHost("host-id")
            .setSubscribedTopicNames(subscribedTopicNames)
            .setAssignment(
                new ShareGroupDescribeResponseData.Assignment()
                    .setTopicPartitions(Collections.singletonList(new ShareGroupDescribeResponseData.TopicPartitions()
                        .setTopicId(topicId1)
                        .setTopicName("topic1")
                        .setPartitions(assignedPartitions)
                    ))
            );

        assertEquals(expected, actual);
    }