private static void checkNumReplicasPerDatacenter(List<PartitionId> allocatedPartitions, int numReplicas) {
    for (PartitionId partition : allocatedPartitions) {
      Map<String, Integer> numReplicasMap = new HashMap<>();
      for (ReplicaId replica : partition.getReplicaIds()) {
        String datacenter = replica.getDataNodeId().getDatacenterName();
        Integer replicasInDatacenter = numReplicasMap.getOrDefault(datacenter, 0);
        numReplicasMap.put(datacenter, replicasInDatacenter + 1);
      }
      for (int replicasInDatacenter : numReplicasMap.values()) {
        assertEquals("Datacenter does not have expected number of replicas", numReplicas, replicasInDatacenter);
      }
    }
  }
Verify that the partitions in the list have {@code numReplicas} per datacenter

@param allocatedPartitions the list of partitions to check
@param numReplicas how many replicas a partition should have in each datacenter
ambry-clustermap/src/test/java/com/github/ambry/clustermap/StaticClusterManagerTest.java