@Test public void createBackup_failOnBackupException() throws BackupException { String exceptionMsg = "exMsg"; exceptionRule.expect(BackupException.class); exceptionRule.expectMessage(exceptionMsg); doThrow(new BackupException(exceptionMsg)).when(backupUploaderMock).doWriteBackup(isA(InputStream.class), anyString()); backupUploadService.createBackup(backupInputStream, UNIQUE_FILE_NAME); }
@Override public BackupState createBackup(InputStream inputStream, String uniqueFileName) throws IBackupUploader.BackupException { backupUploader.doWriteBackup(inputStream, uniqueFileName); log.debug("sopInstanceUID={}, backup saved.", uniqueFileName); return new BackupState(uniqueFileName, attemptsAmount); }
BackupUploadService implements IBackupUploadService { @Override public BackupState createBackup(InputStream inputStream, String uniqueFileName) throws IBackupUploader.BackupException { backupUploader.doWriteBackup(inputStream, uniqueFileName); log.debug("sopInstanceUID={}, backup saved.", uniqueFileName); return new BackupState(uniqueFileName, attemptsAmount); } }
BackupUploadService implements IBackupUploadService { @Override public BackupState createBackup(InputStream inputStream, String uniqueFileName) throws IBackupUploader.BackupException { backupUploader.doWriteBackup(inputStream, uniqueFileName); log.debug("sopInstanceUID={}, backup saved.", uniqueFileName); return new BackupState(uniqueFileName, attemptsAmount); } BackupUploadService(IBackupUploader backupUploader, BackupFlags backupFlags, DelayCalculator delayCalculator); }
BackupUploadService implements IBackupUploadService { @Override public BackupState createBackup(InputStream inputStream, String uniqueFileName) throws IBackupUploader.BackupException { backupUploader.doWriteBackup(inputStream, uniqueFileName); log.debug("sopInstanceUID={}, backup saved.", uniqueFileName); return new BackupState(uniqueFileName, attemptsAmount); } BackupUploadService(IBackupUploader backupUploader, BackupFlags backupFlags, DelayCalculator delayCalculator); @Override BackupState createBackup(InputStream inputStream, String uniqueFileName); @Override InputStream getBackupStream(String uniqueFileName); @Override void startUploading(IDicomWebClient webClient, BackupState backupState); @Override void removeBackup(String fileName); boolean filterHttpCode(Integer actualHttpStatus); }
BackupUploadService implements IBackupUploadService { @Override public BackupState createBackup(InputStream inputStream, String uniqueFileName) throws IBackupUploader.BackupException { backupUploader.doWriteBackup(inputStream, uniqueFileName); log.debug("sopInstanceUID={}, backup saved.", uniqueFileName); return new BackupState(uniqueFileName, attemptsAmount); } BackupUploadService(IBackupUploader backupUploader, BackupFlags backupFlags, DelayCalculator delayCalculator); @Override BackupState createBackup(InputStream inputStream, String uniqueFileName); @Override InputStream getBackupStream(String uniqueFileName); @Override void startUploading(IDicomWebClient webClient, BackupState backupState); @Override void removeBackup(String fileName); boolean filterHttpCode(Integer actualHttpStatus);  }