@Test public void downloadBackup() throws Exception { byte[] bytes = "teststring".getBytes(StandardCharsets.UTF_8); when(backupRepository.readBackupFile(BACKUP_FILE_1_NAME)).thenReturn(bytes); byte[] response = backupService.readBackupFile(BACKUP_FILE_1_NAME); assertEquals(bytes.length, response.length); }
public byte[] readBackupFile(String filename) throws BackupFileNotFoundException { if (!getBackup(filename).isPresent()) { throw new BackupFileNotFoundException(getFileNotFoundExceptionMessage(filename)); } return backupRepository.readBackupFile(filename); }
BackupService { public byte[] readBackupFile(String filename) throws BackupFileNotFoundException { if (!getBackup(filename).isPresent()) { throw new BackupFileNotFoundException(getFileNotFoundExceptionMessage(filename)); } return backupRepository.readBackupFile(filename); } }
BackupService { public byte[] readBackupFile(String filename) throws BackupFileNotFoundException { if (!getBackup(filename).isPresent()) { throw new BackupFileNotFoundException(getFileNotFoundExceptionMessage(filename)); } return backupRepository.readBackupFile(filename); } @Autowired  BackupService(BackupRepository backupRepository, ServerConfService serverConfService,
            ExternalProcessRunner externalProcessRunner,
            @Value("${script.generate-backup.path}") String generateBackupScriptPath,
            AuditDataHelper auditDataHelper); }
BackupService { public byte[] readBackupFile(String filename) throws BackupFileNotFoundException { if (!getBackup(filename).isPresent()) { throw new BackupFileNotFoundException(getFileNotFoundExceptionMessage(filename)); } return backupRepository.readBackupFile(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 byte[] readBackupFile(String filename) throws BackupFileNotFoundException { if (!getBackup(filename).isPresent()) { throw new BackupFileNotFoundException(getFileNotFoundExceptionMessage(filename)); } return backupRepository.readBackupFile(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();  }