private static List<ApiMessageAndVersion> filter(List<ApiMessageAndVersion> records, Class<? extends ApiMessage> clazz) {
        return records.stream().filter(r -> clazz.equals(r.message().getClass())).collect(Collectors.toList());
    }
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