BackupManager { public static List<File> getBackupList(String bookUID) { File[] backupFiles = new File(getBackupFolderPath(bookUID)).listFiles(); Arrays.sort(backupFiles); List<File> backupFilesList = Arrays.asList(backupFiles); Collections.reverse(backupFilesList); return backupFilesList; }  static boolean backupActiveBook(); static boolean backupBook(String bookUID); @Nullable static String getBookBackupFileUri(String bookUID); static List<File> getBackupList(String bookUID); static void schedulePeriodicBackups(Context context); static final String KEY_BACKUP_FILE; }
@Test public void getBackupList() throws Exception { String bookUID = createNewBookWithDefaultAccounts(); BookUtils.activateBook(bookUID); BackupManager.backupActiveBook(); Thread.sleep(1000); BackupManager.backupActiveBook(); assertThat(BackupManager.getBackupList(bookUID).size()).isEqualTo(2); }
@Test public void whenNoBackupsHaveBeenDone_shouldReturnEmptyBackupList() { String bookUID = createNewBookWithDefaultAccounts(); BookUtils.activateBook(bookUID); assertThat(BackupManager.getBackupList(bookUID)).isEmpty(); }