### Question:
FileImportTask { @Scheduled( initialDelayString = "${codekvast.dashboard.fileImportInitialDelaySeconds:5}000", fixedRateString = "${codekvast.dashboard.fileImportIntervalSeconds}000") public void importPublicationFiles() { new NamedThreadTemplate().doInNamedThread("FileImportTask", this::processQueue); }  @PostConstruct void postConstruct(); @Scheduled( initialDelayString = "${codekvast.dashboard.fileImportInitialDelaySeconds:5}000", fixedRateString = "${codekvast.dashboard.fileImportIntervalSeconds}000") void importPublicationFiles(); void doProcessFile(File file);  }### Answer:
@Test public void should_handle_empty_fileImportQueuePath() { task.importPublicationFiles(); verifyNoMoreInteractions(importer); }
@Test public void should_ignore_non_ser_files() throws Exception { File file = createImportFile(".bar"); task.importPublicationFiles(); assertThat(file.exists(), is(true)); verifyNoMoreInteractions(importer); }
@Test public void should_delete_file_after_successful_import() throws Exception { settings.setDeleteImportedFiles(true); File file = createImportFile(".ser"); when(importer.importPublicationFile(any(File.class))).thenReturn(true); task.importPublicationFiles(); verify(importer).importPublicationFile(file); assertThat(file.exists(), is(false)); }
@Test public void should_not_delete_file_after_failed_import() throws Exception { settings.setDeleteImportedFiles(true); File file = createImportFile(".ser"); when(importer.importPublicationFile(any(File.class))).thenReturn(false); task.importPublicationFiles(); verify(importer).importPublicationFile(file); assertThat(file.exists(), is(true)); }
@Test public void should_not_delete_file_after_import() throws Exception { settings.setDeleteImportedFiles(false); File file = createImportFile(".ser"); task.importPublicationFiles(); verify(importer).importPublicationFile(file); assertThat(file.exists(), is(true)); }