@Test
  public void testUpdateNewQuotaResources() throws AccountServiceException {
    // 1. Register account update consumer.
    inMemAccountService.addAccountUpdateConsumer(ambryCUQuotaSource::updateNewQuotaResources);

    // 2. Create an account with account quota, and another account with container quotas.
    Account accountWithAccountQuota =
        createAccountForQuota(new JsonCUQuotaDataProviderUtil.MapOrQuota(new CapacityUnit()), "106");
    Map<String, CapacityUnit> containerQuotas = new HashMap<String, CapacityUnit>() {{
      put("1", new CapacityUnit());
      put("2", new CapacityUnit());
    }};
    Account accountWithContainerQuota =
        createAccountForQuota(new JsonCUQuotaDataProviderUtil.MapOrQuota(containerQuotas), "107");

    // 3. Verify that the quota sources doesn't already contain the new accounts.
    Map<String, CapacityUnit> allQuotas = ambryCUQuotaSource.getAllQuota();
    Assert.assertFalse(allQuotas.containsKey("106"));
    Assert.assertFalse(allQuotas.containsKey("107_1"));
    Assert.assertFalse(allQuotas.containsKey("107_2"));

    // 4. Update the account service with the new accounts.
    inMemAccountService.updateAccounts(Arrays.asList(accountWithAccountQuota, accountWithContainerQuota));

    // 5. Ensure that the quota source contains the newly created accounts
    allQuotas = ambryCUQuotaSource.getAllQuota();
    Assert.assertTrue(allQuotas.containsKey("106"));
    Assert.assertTrue(allQuotas.containsKey("107_1"));
    Assert.assertTrue(allQuotas.containsKey("107_2"));
    Map<String, CapacityUnit> allUsages = ambryCUQuotaSource.getAllQuotaUsage();
    Assert.assertTrue(allUsages.containsKey("106"));
    Assert.assertTrue(allUsages.containsKey("107_1"));
    Assert.assertTrue(allUsages.containsKey("107_2"));
  }
Create test setup by creating the {@link AmbryCUQuotaSource} object and updating account service.
@throws IOException
@throws AccountServiceException
ambry-quota/src/test/java/com/github/ambry/quota/capacityunit/AmbryCUQuotaSourceTest.java