public int distanceOf(PartitionTableView partitionTableView) {
        int distance = 0;
        for (int i = 0; i < partitions.length; i++) {
            distance += distanceOf(partitions[i], partitionTableView.partitions[i]);
        }
        return distance;
    }
@Test
    public void testDistance_whenReplicasExchanged() throws Exception {
        // distanceOf([A, B, C], [B, A, C]) == 2
        PartitionTableView table1 = createRandomPartitionTable();

        InternalPartition[] partitions = extractPartitions(table1);
        PartitionReplica[] replicas = partitions[0].getReplicasCopy();
        PartitionReplica temp = replicas[0];
        replicas[0] = replicas[1];
        replicas[1] = temp;
        partitions[0] = new ReadonlyInternalPartition(replicas, 0, partitions[0].version());
        PartitionTableView table2 = new PartitionTableView(partitions);

        assertEquals(2, table2.distanceOf(table1));
    }