@Test
  public void testHostRemoval() throws Exception {
    // Publish some data to account stats store
    StatsManager.AccountStatsPublisher publisher = statsManager.new AccountStatsPublisher(accountStatsMySqlStore);
    publisher.run();

    mockClusterMap.invokeListenerForDataNodeRemoval(currentNode);
    // There should be a task scheduled to delete this current from the account stats store
    // Sleep for a while so the task can be executed
    Thread.sleep(2000);
    HostAccountStorageStatsWrapper statsWrapper =
        accountStatsMySqlStore.queryHostAccountStorageStatsByHost(currentNode.getHostname(), currentNode.getPort());
    assertEquals(0, statsWrapper.getStats().getStorageStats().size());
  }
Test partition class stats publisher
@throws Exception
ambry-server/src/integration-test/java/com/github/ambry/server/StatsManagerIntegrationTest.java