@Test void should_handle_job_status_ko_during_dump_download() throws Exception { // Given ImportDataEvent event = new ImportDataEvent( this, almRepository, DUMPSET_NAME, ENVIRONMENT, superTask, dump ); when(dumpAvailabilityDao.findByPerimeterAndNameAndDatabase( almRepository.getPerimeter(), DUMPSET_NAME, almRepository.getDbName())) .thenReturn(Optional.empty()); when(dumpDao.findByPerimeterAndNameAndEnvironment( almRepository.getPerimeter(), DUMPSET_NAME, ENVIRONMENT)) .thenReturn(Optional.of(givenDumpEntity())); List<String> fileList = List.of("file1.sql", "file2.sql"); when(dumpHelper.getListOfDumpFiles(any(DumpSetDto.class))).thenReturn(fileList); ...