@Test
  public void testBlobStoreStale() throws Exception {
    store.shutdown();
    ReplicaId replicaId = getMockReplicaId(tempDirStr);
    StoreConfig config = new StoreConfig(new VerifiableProperties(properties));
    MetricRegistry registry = new MetricRegistry();
    storeMetrics = new StoreMetrics(registry);

    // restart, it starts normally
    MockBlobStoreStats mockBlobStoreStats = new MockBlobStoreStats(time);
    store = new MockBlobStore(replicaId, config, null, storeMetrics, mockBlobStoreStats);
    store.start();
    store.shutdown();

    // config.storeStaleBlockBootup is true
    properties.put("store.stale.time.in.days", Integer.toString(1));
    properties.put("store.block.stale.blob.store.to.start", "true");
    // sleep for 2 days.
    time.sleep(TimeUnit.DAYS.toMillis(config.storeStaleTimeInDays * 2));
    config = new StoreConfig(new VerifiableProperties(properties));
    mockBlobStoreStats = new MockBlobStoreStats(time);
    store = new MockBlobStore(replicaId, config, null, storeMetrics, mockBlobStoreStats);
    try {
      store.start();
      fail("Shouldn't be successful.");
    } catch (StoreException e) {
      assertEquals(StoreErrorCodes.InitializationError, e.getErrorCode());
      assertTrue(e.getMessage().contains("stale"));
    }

    // config.storeStaleBlockBootup is false
    properties.put("store.block.stale.blob.store.to.start", "false");
    config = new StoreConfig(new VerifiableProperties(properties));
    mockBlobStoreStats = new MockBlobStoreStats(time);
    store = new MockBlobStore(replicaId, config, null, storeMetrics, mockBlobStoreStats);
    store.start();
  }
Test {@link BlobStoreStats}'s handle new entries method and make sure the correct {@link IndexValue}s are passed
to these methods.
@throws Exception
ambry-store/src/test/java/com/github/ambry/store/BlobStoreTest.java