FileExtensionPathMatcher implements PathMatcher { @Override public boolean matches(Path path) { Path fileName = path.getFileName(); if (fileName != null) { return extensions.contains(Files.getFileExtension(fileName.toString())); } return false; } FileExtensionPathMatcher(String extension, String... extensions);  FileExtensionPathMatcher(Collection<String> extensions); @Override boolean matches(Path path);  }
@Test public void test() { assertEquals(shouldMatch, matcher.matches(testPath)); }