ClustersFilter implements PathFilter { @Override public boolean accept(Path path) { String pathString = path.toString(); return pathString.contains("/clusters-"); }  @Override boolean accept(Path path);  }
@Test public void testAcceptNotFinal() throws Exception { Path path0 = new Path(output, "clusters-0"); Path path1 = new Path(output, "clusters-1"); path0.getFileSystem(configuration).createNewFile(path0); path1.getFileSystem(configuration).createNewFile(path1); PathFilter clustersFilter = new ClustersFilter(); assertTrue(clustersFilter.accept(path0)); assertTrue(clustersFilter.accept(path1)); }
@Test public void testAcceptFinalPath() throws IOException { Path path0 = new Path(output, "clusters-0"); Path path1 = new Path(output, "clusters-1"); Path path2 = new Path(output, "clusters-2"); Path path3Final = new Path(output, "clusters-3-final"); path0.getFileSystem(configuration).createNewFile(path0); path1.getFileSystem(configuration).createNewFile(path1); path2.getFileSystem(configuration).createNewFile(path2); path3Final.getFileSystem(configuration).createNewFile(path3Final); PathFilter clustersFilter = new ClustersFilter(); assertTrue(clustersFilter.accept(path0)); assertTrue(clustersFilter.accept(path1)); assertTrue(clustersFilter.accept(path2)); assertTrue(clustersFilter.accept(path3Final)); }