### Question:
PosixPathMatcher implements PathMatcher { @Override public boolean matches(Path path) { return (path != null) && pattern.matcher(path.getFileName().toString()).matches(); } PosixPathMatcher(final String pattern);  PosixPathMatcher(final String pattern, boolean caseInsensitive); @Override boolean matches(Path path);  }### Answer:
@Test public void testMatcher() throws IOException { PathMatcher phgMatcher = new PosixPathMatcher("*.png"); assertTrue(phgMatcher.matches(Paths.get("test.png"))); assertFalse(phgMatcher.matches(Paths.get("test.jpeg"))); assertTrue(phgMatcher.matches(Paths.get("/tmp/path/test.png"))); assertFalse(phgMatcher.matches(Paths.get("/tmp/path/test.jpeg"))); }
@Test public void testMatcherCaseUnsensitive() throws IOException { PathMatcher phgMatcher = new PosixPathMatcher("*.pNg", true); assertTrue(phgMatcher.matches(Paths.get("test.png"))); assertFalse(phgMatcher.matches(Paths.get("test.jpeg"))); assertTrue(phgMatcher.matches(Paths.get("/tmp/path/test.PNG"))); assertFalse(phgMatcher.matches(Paths.get("/tmp/path/test.jpeg"))); }