@Test
  public void testOrderOfPartitionsAddedAndRemoved() {
    prioritizationManager.start();

    // Create and add partitions in a specific order
    int partitionId1 = 1;
    int partitionId2 = 2;
    int partitionId3 = 3;
    PartitionId partition1 = new MockPartitionId(partitionId1, MockClusterMap.DEFAULT_PARTITION_CLASS,
        clusterMap.getDataNodes(), 0);
    PartitionId partition2 = new MockPartitionId(partitionId2, MockClusterMap.DEFAULT_PARTITION_CLASS,
        clusterMap.getDataNodes(), 0);
    PartitionId partition3 = new MockPartitionId(partitionId3, MockClusterMap.DEFAULT_PARTITION_CLASS,
        clusterMap.getDataNodes(), 0);

    assertTrue(prioritizationManager.addReplica(partition1.getReplicaIds().get(0)));
    assertTrue(prioritizationManager.addReplica(partition2.getReplicaIds().get(0)));
    assertTrue(prioritizationManager.addReplica(partition3.getReplicaIds().get(0)));

    // Retrieve and remove partitions in the same order
    List<ReplicaId> replicas = prioritizationManager.getPartitionListForDisk(
        partition1.getReplicaIds().get(0).getDiskId(), 3);

    assertEquals("First partition should match", partition1.getReplicaIds().get(0), replicas.get(0));
    assertEquals("Second partition should match", partition2.getReplicaIds().get(0), replicas.get(1));
    assertEquals("Third partition should match", partition3.getReplicaIds().get(0), replicas.get(2));
    prioritizationManager.reset();
  }
Adding replicas to the prioritization manager before starting it should fail.
ambry-prioritization/src/test/java/com/github/ambry/replica/prioritization/FSFCPrioritizationManagerTest.java