protected Set<ReplicaId> getRemoteLeaderReplicasWithLeaderPartitionsOnLocalNode(ClusterMap clusterMap,
      DataNodeId localNode, DataNodeId remoteNode) {
    Set<ReplicaId> remoteLeaderReplicas = new HashSet<>();
    List<? extends ReplicaId> localReplicas = clusterMap.getReplicaIds(localNode);
    List<? extends ReplicaId> remoteReplicas = clusterMap.getReplicaIds(remoteNode);
    for (int i = 0; i < localReplicas.size(); i++) {
      MockReplicaId localReplica = (MockReplicaId) localReplicas.get(i);
      MockReplicaId remoteReplica = (MockReplicaId) remoteReplicas.get(i);
      if (localReplica.getReplicaState() == ReplicaState.LEADER
          && remoteReplica.getReplicaState() == ReplicaState.LEADER) {
        remoteLeaderReplicas.add(remoteReplicas.get(i));
      }
    }
    return remoteLeaderReplicas;
  }
Get remote leader replicas in remote node whose partitions have leaders in local node as well.
@return list of leader replicas
ambry-replication/src/test/java/com/github/ambry/replication/ReplicationTestHelper.java