@Test
  public void testInitCacheOnStartUp() throws SQLException, IOException {
    Container testContainer =
        new ContainerBuilder((short) 1, "testContainer", Container.ContainerStatus.ACTIVE, "testContainer",
            (short) 1).build();
    Account testAccount = new AccountBuilder((short) 1, "testAccount", Account.AccountStatus.ACTIVE).containers(
        Collections.singleton(testContainer)).build();
    when(mockMySqlAccountStore.getNewAccounts(0)).thenReturn(new ArrayList<>(Collections.singletonList(testAccount)));
    mySqlAccountService = getAccountService();

    // Test in-memory cache is updated with accounts from mysql store on start up.
    List<Account> accounts = new ArrayList<>(mySqlAccountService.getAllAccounts());
    assertEquals("Mismatch in number of accounts", 1, accounts.size());
    assertEquals("Mismatch in account information", testAccount, accounts.get(0));
    assertTrue("Sync time not updated",
        mySqlAccountService.accountServiceMetrics.timeInSecondsSinceLastSyncGauge.getValue() < 10);
    assertEquals("Unexpected container count", 1,
        mySqlAccountService.accountServiceMetrics.containerCountGauge.getValue().intValue());
  }
Tests in-memory cache is updated with accounts from mysql db store on start up
ambry-account/src/test/java/com/github/ambry/account/MySqlAccountServiceTest.java