private void updateReplicaAndStateIfNeeded() {
    if(replicaAndState.isEmpty()) {
      Set<String> datacenterNames = new HashSet<>();
      for(ReplicaId replicaId : replicaIds) {
        if(!datacenterNames.contains(replicaId.getDataNodeId().getDatacenterName())) {
          replicaAndState.put(replicaId, ReplicaState.LEADER);
          datacenterNames.add(replicaId.getDataNodeId().getDatacenterName());
        } else {
          replicaAndState.put(replicaId, ReplicaState.STANDBY);
        }
      }
    }
  }
Updates the mapping of {@link ReplicaState} to {@link ReplicaState} if needed.
ambry-test-utils/src/main/java/com/github/ambry/clustermap/MockPartitionId.java