@Test public void getListOfMediaFiles_ShouldReturnEmptyList_IfNoFilesFound() throws Exception { Path dir1 = createDirectory(inputDir.resolve("1")); List<Media> result = subject.getListOfMediaFiles(dir1); assertThat(result).isEmpty(); }
List<Media> getListOfMediaFiles(Path path) { log.info("Scanning for media files in {}", path); return scannerProvider.get() .searchIn(path) .withRecursion(true) .withFileExtensions(scanConfig.allowed_extensions()) .whileSkippingExtraFilesWith(scanConfig.skip_extension_name()) .whileSkippingExtraFilesIn(scanConfig.mark_source_dir()) .streamAndIgnoreErrors() .map(file -> buildMedia(path, file)) .peek(candidate -> log.info("Found file: {}", candidate)) .collect(Collectors.toList()); }
MediaScanServiceImpl implements MediaScanService { List<Media> getListOfMediaFiles(Path path) { log.info("Scanning for media files in {}", path); return scannerProvider.get() .searchIn(path) .withRecursion(true) .withFileExtensions(scanConfig.allowed_extensions()) .whileSkippingExtraFilesWith(scanConfig.skip_extension_name()) .whileSkippingExtraFilesIn(scanConfig.mark_source_dir()) .streamAndIgnoreErrors() .map(file -> buildMedia(path, file)) .peek(candidate -> log.info("Found file: {}", candidate)) .collect(Collectors.toList()); } }
MediaScanServiceImpl implements MediaScanService { List<Media> getListOfMediaFiles(Path path) { log.info("Scanning for media files in {}", path); return scannerProvider.get() .searchIn(path) .withRecursion(true) .withFileExtensions(scanConfig.allowed_extensions()) .whileSkippingExtraFilesWith(scanConfig.skip_extension_name()) .whileSkippingExtraFilesIn(scanConfig.mark_source_dir()) .streamAndIgnoreErrors() .map(file -> buildMedia(path, file)) .peek(candidate -> log.info("Found file: {}", candidate)) .collect(Collectors.toList()); } @Inject  MediaScanServiceImpl(MediaScanConfig scanConfig,
                         Provider<FileScanner> scannerProvider); }
MediaScanServiceImpl implements MediaScanService { List<Media> getListOfMediaFiles(Path path) { log.info("Scanning for media files in {}", path); return scannerProvider.get() .searchIn(path) .withRecursion(true) .withFileExtensions(scanConfig.allowed_extensions()) .whileSkippingExtraFilesWith(scanConfig.skip_extension_name()) .whileSkippingExtraFilesIn(scanConfig.mark_source_dir()) .streamAndIgnoreErrors() .map(file -> buildMedia(path, file)) .peek(candidate -> log.info("Found file: {}", candidate)) .collect(Collectors.toList()); } @Inject  MediaScanServiceImpl(MediaScanConfig scanConfig,
                         Provider<FileScanner> scannerProvider); @Override Map<Path, List<Media>> retrieveFiles(); @Override List<Media> retrieveFilesAsList(); }
MediaScanServiceImpl implements MediaScanService { List<Media> getListOfMediaFiles(Path path) { log.info("Scanning for media files in {}", path); return scannerProvider.get() .searchIn(path) .withRecursion(true) .withFileExtensions(scanConfig.allowed_extensions()) .whileSkippingExtraFilesWith(scanConfig.skip_extension_name()) .whileSkippingExtraFilesIn(scanConfig.mark_source_dir()) .streamAndIgnoreErrors() .map(file -> buildMedia(path, file)) .peek(candidate -> log.info("Found file: {}", candidate)) .collect(Collectors.toList()); } @Inject  MediaScanServiceImpl(MediaScanConfig scanConfig,
                         Provider<FileScanner> scannerProvider); @Override Map<Path, List<Media>> retrieveFiles(); @Override List<Media> retrieveFilesAsList();  }