private static List<ApiMessageAndVersion> sortPartitionChangeRecords(List<ApiMessageAndVersion> records) {
        records = new ArrayList<>(records);
        records.sort(Comparator.comparing((ApiMessageAndVersion record) -> {
            PartitionChangeRecord partitionChangeRecord = (PartitionChangeRecord) record.message();
            return partitionChangeRecord.topicId() + "-" + partitionChangeRecord.partitionId();
        }));
        return records;
    }
Sorts {@link PartitionChangeRecord} by topic ID and partition ID,
so that the order of the records is deterministic, and can be compared.
metadata/src/test/java/org/apache/kafka/controller/ReplicationControlManagerTest.java