@Test
  public void testStartWithBackupFiles() throws Exception {
    // use testUpdateAccount function to create backups and then delete helixStore data.
    testUpdateAccount();
    if (accountService != null) {
      accountService.close();
    }
    deleteStoreIfExists();

    // should have some backup files.
    if (helixConfigProps.containsKey(HelixAccountServiceConfig.BACKUP_DIRECTORY_KEY)) {
      File[] files = accountBackupDir.toFile()
          .listFiles(path -> BackupFileManager.versionFilenamePattern.matcher(path.getName()).find());
      assertTrue("UpdateAccount should create backup files", files.length > 0);

      helixConfigProps.put(HelixAccountServiceConfig.ENABLE_SERVE_FROM_BACKUP, "true");
      vHelixConfigProps = new VerifiableProperties(helixConfigProps);
      storeConfig = new HelixPropertyStoreConfig(vHelixConfigProps);
      String updaterThreadPrefix = UUID.randomUUID().toString();
      MockHelixAccountServiceFactory mockHelixAccountServiceFactory =
          new MockHelixAccountServiceFactory(vHelixConfigProps, new MetricRegistry(), notifier, updaterThreadPrefix,
              mockRouter);
      accountService = mockHelixAccountServiceFactory.getAccountService();
      assertNotNull("Backup files should have data", accountService.getAllAccounts());
      assertEquals("Number of accounts from backup mismatch", accountService.getAllAccounts().size(),
          1 + NUM_REF_ACCOUNT);
    }
  }
Tests starting up a {@link HelixAccountService}, when the corresponding {@code ZooKeeper} does not have any
{@link ZNRecord} on it but local backup files exists.
@throws Exception Any unexpected exception
ambry-account/src/test/java/com/github/ambry/account/HelixAccountServiceTest.java