void setReplicas(PartitionReplica[] newReplicas) {
        PartitionReplica[] oldReplicas = replicas;
        replicas = newReplicas;
        onReplicasChange(newReplicas, oldReplicas);
    }
@Test
    public void testGetReplicaIndex() {
        replicaOwners[0] = localReplica;
        replicaOwners[1] = new PartitionReplica(newAddress(5001), UuidUtil.newUnsecureUUID());
        partition.setReplicas(replicaOwners);

        assertEquals(0, partition.getReplicaIndex(replicaOwners[0]));
        assertEquals(1, partition.getReplicaIndex(replicaOwners[1]));
        assertEquals(-1, partition.getReplicaIndex(new PartitionReplica(newAddress(6000), UuidUtil.newUnsecureUUID())));
    }