@Test public void startUploading_DicomWebExceptionOnStowRs_secondTry_success() throws DicomWebException, IOException { doThrow(new DicomWebException("Reason", HttpStatus.INTERNAL_SERVER_ERROR_500, Status.ProcessingFailure)) .doNothing().when(webClientMock).stowRs(any(InputStream.class)); when(backupUploaderMock.doReadBackup(eq(UNIQUE_FILE_NAME))).thenReturn(backupInputStream); backupUploadService.startUploading(webClientMock, spyBackupState); ArgumentCaptor<InputStream> argumentCaptor = ArgumentCaptor.forClass(InputStream.class); verify(backupUploaderMock, times(2)).doReadBackup(eq(UNIQUE_FILE_NAME)); verify(webClientMock, times(2)).stowRs(argumentCaptor.capture()); byte [] actualBytes = argumentCaptor.getValue().readNBytes(5); assertThat(Arrays.equals(actualBytes, BACKUP_BYTES)).isTrue(); verify(backupUploaderMock).doRemoveBackup(eq(UNIQUE_FILE_NAME)); }
@Override public void startUploading(IDicomWebClient webClient, BackupState backupState) throws IBackupUploader.BackupException { scheduleUploadWithDelay(webClient, backupState); }
BackupUploadService implements IBackupUploadService { @Override public void startUploading(IDicomWebClient webClient, BackupState backupState) throws IBackupUploader.BackupException { scheduleUploadWithDelay(webClient, backupState); } }
BackupUploadService implements IBackupUploadService { @Override public void startUploading(IDicomWebClient webClient, BackupState backupState) throws IBackupUploader.BackupException { scheduleUploadWithDelay(webClient, backupState); } BackupUploadService(IBackupUploader backupUploader, BackupFlags backupFlags, DelayCalculator delayCalculator); }
BackupUploadService implements IBackupUploadService { @Override public void startUploading(IDicomWebClient webClient, BackupState backupState) throws IBackupUploader.BackupException { scheduleUploadWithDelay(webClient, backupState); } 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 void startUploading(IDicomWebClient webClient, BackupState backupState) throws IBackupUploader.BackupException { scheduleUploadWithDelay(webClient, backupState); } 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);  }