@Test
  public void replicaPreBootstrapToBootstrapSuccessTest() throws Exception {
    generateConfigs(true, false);
    MockDataNodeId localNode = clusterMap.getDataNodes().get(0);
    List<ReplicaId> localReplicas = clusterMap.getReplicaIds(localNode);
    MockClusterParticipant mockHelixParticipant = new MockClusterParticipant();
    StorageManager storageManager =
        createStorageManager(localNode, metricRegistry, Collections.singletonList(mockHelixParticipant));
    storageManager.start();

    // 0. get listeners from Helix participant and verify there is a storageManager listener.
    Map<StateModelListenerType, PartitionStateChangeListener> listeners =
        mockHelixParticipant.getPartitionStateChangeListeners();
    assertTrue("Should contain storage manager listener",
        listeners.containsKey(StateModelListenerType.StorageManagerListener));

    // 1. Test case where new replica(store) is added into StorageManager and transitions from PreBootstrap to Bootstrap
    PartitionId newPartition = clusterMap.createNewPartition(Collections.singletonList(localNode));
    mockHelixParticipant.onPartitionBecomePreBootstrapFromOffline(newPartition.toPathString());
    BlobStore newAddedStore = (BlobStore) storageManager.getStore(newPartition, true);
    assertNotNull("There should be store associated with the partition", newAddedStore);

    mockHelixParticipant.onPartitionBecomeBootstrapFromPreBootstrap(newPartition.toPathString());
    newAddedStore = (BlobStore) storageManager.getStore(newPartition);
    assertNotNull("There should be store associated with the partition", newAddedStore);
    shutdownAndAssertStoresInaccessible(storageManager, localReplicas);
  }
Test for success in PRE-BOOTSTRAP to BOOTSTRAP transition
Starts the {@link StorageManager}
Creates a new partition, transition it from OFFLINE to PRE-BOOTSTRAP
Transition it now from PRE-BOOTSTRAP to BOOTSTRAP and asserts success.
@throws Exception exception
ambry-store/src/test/java/com/github/ambry/store/StorageManagerTest.java