@Test
  public void testHostAccountStorageStats() throws Exception {
    Map<Long, Map<Short, Map<Short, ContainerStorageStats>>> storageStats = new HashMap<>();
    long partitionId = 10000L;
    short accountId = 0;
    short containerId = 100;

    int numberOfPartitions = 2;
    int numberOfAccounts = 2;
    int numberOfContainers = 2;
    for (int i = 0; i < numberOfPartitions; i++) {
      partitionId++;
      if (!storageStats.containsKey(partitionId)) {
        storageStats.put(partitionId, new HashMap<>());
      }
      for (int j = 0; j < numberOfAccounts; j++) {
        accountId++;
        if (!storageStats.get(partitionId).containsKey(accountId)) {
          storageStats.get(partitionId).put(accountId, new HashMap<>());
        }
        for (int k = 0; k < numberOfContainers; k++) {
          containerId++;
          if (!storageStats.get(partitionId).get(accountId).containsKey(containerId)) {
            storageStats.get(partitionId)
                .get(accountId)
                .put(containerId, generateRandomContainerStorageStats(containerId));
          }
        }
      }
    }

    HostAccountStorageStats host1 = new HostAccountStorageStats(storageStats);
    HostAccountStorageStats host2 = new HostAccountStorageStats();
    for (Map.Entry<Long, Map<Short, Map<Short, ContainerStorageStats>>> partitionEntry : storageStats.entrySet()) {
      long pid = partitionEntry.getKey();
      for (Map.Entry<Short, Map<Short, ContainerStorageStats>> accountEntry : partitionEntry.getValue().entrySet()) {
        short aid = accountEntry.getKey();
        for (Map.Entry<Short, ContainerStorageStats> containerEntry : accountEntry.getValue().entrySet()) {
          host2.addContainerStorageStats(pid, aid, containerEntry.getValue());
        }
      }
    }

    Assert.assertEquals(host1.getStorageStats(), host2.getStorageStats());

    // Serialize the host account storage stats
    String serialized = objectMapper.writeValueAsString(host1);
    HostAccountStorageStats deserialized = objectMapper.readValue(serialized, HostAccountStorageStats.class);
    Assert.assertEquals(host1.getStorageStats(), deserialized.getStorageStats());
  }
Test methods in {@link HostAccountStorageStats}.
@throws Exception
ambry-api/src/test/java/com/github/ambry/server/StorageStatsTest.java