@Override
  public List<ReplicaId> getReplicaIdsByState(ReplicaState state, String dcName) {
    invocationCount.incrementAndGet();
    if (resetAllReplicasToStandbyState) {
      if (invocationCount.get() == resetReplicaStateCount) {
        Map<ReplicaId, ReplicaState> replicaStateMap = new HashMap<>();
        for (ReplicaId replica : replicaAndState.keySet()) {
          replicaStateMap.put(replica, ReplicaState.STANDBY);
        }
        replicaAndState = replicaStateMap;
      }
    }
    return replicaIds.stream()
        .filter(r -> replicaAndState.get(r) == state && (dcName == null || r.getDataNodeId()
            .getDatacenterName()
            .equals(dcName)))
        .collect(Collectors.toList());
  }
Mock partition id for unit tests
ambry-test-utils/src/main/java/com/github/ambry/clustermap/MockPartitionId.java