@Test
  public void testReshuffleOneDisk() throws Exception {
    generateConfigs(true, false);
    MockDataNodeId localNode = clusterMap.getDataNodes().get(0);

    Map<DiskId, List<ReplicaId>> diskToReplicaMap = new HashMap<>();
    for (ReplicaId replica : clusterMap.getReplicaIds(localNode)) {
      DiskId disk = replica.getDiskId();
      diskToReplicaMap.computeIfAbsent(disk, key -> new ArrayList<>()).add(replica);
    }

    Map<DiskId, Set<String>> disksToPartitions = new HashMap<>();
    diskToReplicaMap.forEach((diskId, replicaIds) -> {
      Set<String> partitionIds = replicaIds.stream()
          .map(replicaId -> replicaId.getPartitionId().toPathString())
          .collect(Collectors.toSet());
      disksToPartitions.put(diskId, partitionIds);
    });

    assertTrue("We need at least two disks for this test to complete.",diskToReplicaMap.size() > 1);

    // Swap the contents of the first two disks
    Iterator<DiskId> iterator = disksToPartitions.keySet().iterator();
    DiskId firstDisk = iterator.next();
    Set<String> firstDiskContents = disksToPartitions.get(firstDisk);
    DiskId secondDisk = iterator.next();
    Set<String> secondDiskContents = disksToPartitions.get(secondDisk);
    disksToPartitions.put(firstDisk, secondDiskContents);
    disksToPartitions.put(secondDisk, firstDiskContents);

    ReplicaPlacementValidator placementValidator = new ReplicaPlacementValidator();
    Map<DiskId, DiskId> disksToReshuffle = placementValidator.reshuffleDisks(diskToReplicaMap, disksToPartitions);
    Assert.assertTrue(!disksToReshuffle.isEmpty());
  }
Test the case when there one of the disks has been swapped with another disk.
@throws Exception
ambry-store/src/test/java/com/github/ambry/store/StorageManagerTest.java