@Test public void hasAllowedExtension_ShouldReturnTrue_IfNoFilterInstalled() throws Exception { Path testFile = getPath("mp4.mkv"); assertThat(subject.hasAllowedExtension(testFile)).isTrue(); }
boolean hasAllowedExtension(Path path) { return allowedExtensions.map(strings -> strings .stream() .anyMatch(extension -> path.getFileName().toString().endsWith(extension)) ).orElse(true); }
FileScannerImpl implements FileScanner { boolean hasAllowedExtension(Path path) { return allowedExtensions.map(strings -> strings .stream() .anyMatch(extension -> path.getFileName().toString().endsWith(extension)) ).orElse(true); } }
FileScannerImpl implements FileScanner { boolean hasAllowedExtension(Path path) { return allowedExtensions.map(strings -> strings .stream() .anyMatch(extension -> path.getFileName().toString().endsWith(extension)) ).orElse(true); }  }
FileScannerImpl implements FileScanner { boolean hasAllowedExtension(Path path) { return allowedExtensions.map(strings -> strings .stream() .anyMatch(extension -> path.getFileName().toString().endsWith(extension)) ).orElse(true); }  @Override FileScanner searchIn(Path dir); @Override FileScanner withRecursion(boolean recursive); @Override FileScanner withDepth(Integer value); @Override FileScanner withDirectories(boolean dirs); @Override FileScanner withFileExtensions(List<String> allowedExtensions); @Override FileScanner whileSkippingExtraFilesWith(String skipping); @Override FileScanner whileSkippingExtraFilesIn(Path dir); @Override Optional<List<Path>> scan(); @Override Stream<Path> stream(); @Override Stream<Path> streamAndIgnoreErrors(); }
FileScannerImpl implements FileScanner { boolean hasAllowedExtension(Path path) { return allowedExtensions.map(strings -> strings .stream() .anyMatch(extension -> path.getFileName().toString().endsWith(extension)) ).orElse(true); }  @Override FileScanner searchIn(Path dir); @Override FileScanner withRecursion(boolean recursive); @Override FileScanner withDepth(Integer value); @Override FileScanner withDirectories(boolean dirs); @Override FileScanner withFileExtensions(List<String> allowedExtensions); @Override FileScanner whileSkippingExtraFilesWith(String skipping); @Override FileScanner whileSkippingExtraFilesIn(Path dir); @Override Optional<List<Path>> scan(); @Override Stream<Path> stream(); @Override Stream<Path> streamAndIgnoreErrors();  }