void changeLeaderReplicaForPartition(String partition, String newLeaderInstance) {
    String currentLeaderInstance = partitionToLeaderReplica.get(partition);
    // set current leader replica to STANDBY state
    instanceToReplicaStateInfos.get(currentLeaderInstance).setReplicaState(partition, ReplicaState.STANDBY.name());
    // set previous standby replica to LEADER state
    instanceToReplicaStateInfos.get(newLeaderInstance).setReplicaState(partition, ReplicaState.LEADER.name());
    partitionToLeaderReplica.put(partition, newLeaderInstance);
    // Update external view maps
    String resource = partitionToResourceMap.get(partition);
    ResourceInfo resourceInfo = resourceToResourceInfoMap.get(resource);
    resourceInfo.setReplicasState(partition, currentLeaderInstance, ReplicaState.STANDBY.name());
    resourceInfo.setReplicasState(partition, newLeaderInstance, ReplicaState.LEADER.name());
  }
Change leader replica of certain partition from current one to the replica on specified instance.
@param partition the partition whose leader replica should be changed.
@param newLeaderInstance the instance on which new leader replica resides.
ambry-clustermap/src/test/java/com/github/ambry/clustermap/MockHelixAdmin.java