@Test public void deleteNonExistingBackup() { try { backupService.deleteBackup("test_file.tar"); fail("should throw BackupFileNotFoundException"); } catch (BackupFileNotFoundException expected) { } }
public void deleteBackup(String filename) throws BackupFileNotFoundException { auditDataHelper.putBackupFilename(backupRepository.getFilePath(filename)); if (!getBackup(filename).isPresent()) { throw new BackupFileNotFoundException(getFileNotFoundExceptionMessage(filename)); } backupRepository.deleteBackupFile(filename); }
BackupService { public void deleteBackup(String filename) throws BackupFileNotFoundException { auditDataHelper.putBackupFilename(backupRepository.getFilePath(filename)); if (!getBackup(filename).isPresent()) { throw new BackupFileNotFoundException(getFileNotFoundExceptionMessage(filename)); } backupRepository.deleteBackupFile(filename); } }
BackupService { public void deleteBackup(String filename) throws BackupFileNotFoundException { auditDataHelper.putBackupFilename(backupRepository.getFilePath(filename)); if (!getBackup(filename).isPresent()) { throw new BackupFileNotFoundException(getFileNotFoundExceptionMessage(filename)); } backupRepository.deleteBackupFile(filename); } @Autowired  BackupService(BackupRepository backupRepository, ServerConfService serverConfService,
            ExternalProcessRunner externalProcessRunner,
            @Value("${script.generate-backup.path}") String generateBackupScriptPath,
            AuditDataHelper auditDataHelper); }
BackupService { public void deleteBackup(String filename) throws BackupFileNotFoundException { auditDataHelper.putBackupFilename(backupRepository.getFilePath(filename)); if (!getBackup(filename).isPresent()) { throw new BackupFileNotFoundException(getFileNotFoundExceptionMessage(filename)); } backupRepository.deleteBackupFile(filename); } @Autowired  BackupService(BackupRepository backupRepository, ServerConfService serverConfService,
            ExternalProcessRunner externalProcessRunner,
            @Value("${script.generate-backup.path}") String generateBackupScriptPath,
            AuditDataHelper auditDataHelper); List<BackupFile> getBackupFiles(); void deleteBackup(String filename); byte[] readBackupFile(String filename); BackupFile generateBackup(); BackupFile uploadBackup(Boolean ignoreWarnings, String filename, byte[] fileBytes); String generateBackupFileName(); }
BackupService { public void deleteBackup(String filename) throws BackupFileNotFoundException { auditDataHelper.putBackupFilename(backupRepository.getFilePath(filename)); if (!getBackup(filename).isPresent()) { throw new BackupFileNotFoundException(getFileNotFoundExceptionMessage(filename)); } backupRepository.deleteBackupFile(filename); } @Autowired  BackupService(BackupRepository backupRepository, ServerConfService serverConfService,
            ExternalProcessRunner externalProcessRunner,
            @Value("${script.generate-backup.path}") String generateBackupScriptPath,
            AuditDataHelper auditDataHelper); List<BackupFile> getBackupFiles(); void deleteBackup(String filename); byte[] readBackupFile(String filename); BackupFile generateBackup(); BackupFile uploadBackup(Boolean ignoreWarnings, String filename, byte[] fileBytes); String generateBackupFileName();  }