AntPathMatcher { public static boolean filter(final Collection<String> includes, final Collection<String> excludes, final Path path) { checkNotNull("includes", includes); checkNotNull("excludes", excludes); checkNotNull("path", path); if (includes.isEmpty() && excludes.isEmpty()) { return true; } else if (includes.isEmpty()) { return !(excludes(excludes, path)); } else if (excludes.isEmpty()) { return includes(includes, path); } return includes(includes, path) && !(excludes(excludes, path)); }  static boolean filter(final Collection<String> includes,
                                 final Collection<String> excludes,
                                 final Path path); static boolean filter(final Collection<String> includes,
                                 final Collection<String> excludes,
                                 final URI uri); static boolean includes(final Collection<String> patterns,
                                   final Path path); static boolean includes(final Collection<String> patterns,
                                   final URI uri); static boolean excludes(final Collection<String> patterns,
                                   final URI uri); static boolean excludes(final Collection<String> patterns,
                                   final Path path);  }
@Test public void testFilter() { final Collection<String> includes = new ArrayList<String>() {{ add("git: }}; final Collection<String> excludes = new ArrayList<String>() {{ add("default: }}; { final Path path = Paths.get(URI.create("file: Assert.assertFalse(filter(includes, excludes, path)); } { final Path path = Paths.get(URI.create("git: Assert.assertTrue(filter(includes, excludes, path)); } { final Path path = Paths.get(URI.create("git: Assert.assertTrue(filter(includes, excludes, path)); } Assert.assertTrue(filter(Collections.<String>emptyList(), Collections.<String>emptyList(), Paths.get(URI.create("git: Assert.assertTrue(filter(Collections.<String>emptyList(), Collections.<String>emptyList(), Paths.get(URI.create("git: }
@Test public void testFilterUri() { final Collection<String> includes = new ArrayList<String>() {{ add("git: }}; final Collection<String> excludes = new ArrayList<String>() {{ add("file: }}; Assert.assertFalse(filter(includes, excludes, URI.create("file: Assert.assertTrue(filter(includes, excludes, URI.create("git: Assert.assertTrue(filter(includes, excludes, URI.create("git: Assert.assertTrue(filter(Collections.<String>emptyList(), Collections.<String>emptyList(), URI.create("file: Assert.assertTrue(filter(Collections.<String>emptyList(), Collections.<String>emptyList(), URI.create("git: }