### Question:
DataUploaderProviderManager { @Async("taskExecutor") @SuppressWarnings("PMD.AvoidCatchingGenericException") public void transferData(TransferTask transferTask) { try { dataUploaderProvider.getStorageUploader(transferTask).transfer(transferTask); log.info(String.format("File has been successfully transferred from %s to %s.", transferTask.getSource().getPath(), transferTask.getDestination().getPath())); taskService.updateStatus(transferTask.getId(), TaskStatus.SUCCESS); } catch (Exception e) { taskService.updateStatus(transferTask.getId(), TaskStatus.FAILURE, e.getMessage()); log.error(String.format("Transfer data went bad due to: %s", e.getMessage()), e); } }  @Async("taskExecutor") @SuppressWarnings("PMD.AvoidCatchingGenericException") void transferData(TransferTask transferTask);  }### Answer:
@Test void transferDataShouldSetSuccessTaskStatusAfterItFinishes() { manager.transferData(transferTask); verify(taskService).updateStatus(eq(transferTask.getId()), eq(TaskStatus.SUCCESS)); }
@Test void transferDataShouldSetFailureStatusAndFailureReasonIfItFails() { doThrow(exception).when(dataUploader).transfer(eq(transferTask)); manager.transferData(transferTask); verify(taskService).updateStatus(eq(transferTask.getId()), eq(TaskStatus.FAILURE), eq(exception.getMessage())); }