private List<ConsumerGroupHeartbeatResponseData.TopicPartitions> fromAssignmentMap(
        Map<Uuid, Set<Integer>> assignment
    ) {
        return assignment.entrySet().stream()
            .map(keyValue -> new ConsumerGroupHeartbeatResponseData.TopicPartitions()
                .setTopicId(keyValue.getKey())
                .setPartitions(new ArrayList<>(keyValue.getValue())))
            .collect(Collectors.toList());
    }
Deserialize the subscription in JoinGroupRequestProtocolCollection.
All the protocols have the same subscription, so the method picks a random one.

@param protocols The JoinGroupRequestProtocolCollection.
@return The ConsumerProtocolSubscription.
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java