@Test
  public void testGetLatestAccountMap_MixedBackupFiles() throws IOException {
    final long baseModifiedTime = System.currentTimeMillis() / 1000 - 100;
    final long interval = 2;
    // Backup files without version should be created before files with version;
    final int backupFileNoVersionCount = 2;
    createBackupFilesWithoutVersion(accountBackupDir, backupFileNoVersionCount, baseModifiedTime, interval, false);
    final int startVersion = 1;
    final int endVersion = 3;
    String[] filenames = createBackupFilesWithVersion(accountBackupDir, startVersion, endVersion,
        baseModifiedTime + 2 * backupFileNoVersionCount * interval, interval, false);
    saveAccountsToFile(Collections.singleton(refAccount), accountBackupDir.resolve(filenames[filenames.length - 1]));

    BackupFileManager backup =
        new BackupFileManager(accountServiceMetrics, config.backupDir, config.maxBackupFileCount);
    Collection<Account> obtained = backup.getLatestAccounts(0);
    assertEquals(Collections.singletonList(refAccount), obtained);
    assertFalse("There are backup files", backup.isEmpty());
    assertEquals(backup.size(), endVersion - startVersion + 1 + backupFileNoVersionCount);
  }
Test getLatestAccounts function when some of the files are with version number and some are not.
@throws IOException if I/O error occurs
ambry-account/src/test/java/com/github/ambry/account/BackupFileManagerTest.java