### Question:
DrillFileSystemUtil { public static List<FileStatus> listAll(FileSystem fs, Path path, boolean recursive, PathFilter... filters) throws IOException { return FileSystemUtil.listAll(fs, path, recursive, FileSystemUtil.mergeFilters(DRILL_SYSTEM_FILTER, filters)); }  static List<FileStatus> listDirectories(final FileSystem fs, Path path, boolean recursive, PathFilter... filters); static List<FileStatus> listFiles(final FileSystem fs, Path path, boolean recursive, PathFilter... filters); static List<FileStatus> listAll(FileSystem fs, Path path, boolean recursive, PathFilter... filters); static final PathFilter DRILL_SYSTEM_FILTER; }### Answer:
@Test public void testListAllWithoutFilter() throws IOException { List<FileStatus> statuses = DrillFileSystemUtil.listAll(fs, new Path(base, "a"), false); assertEquals("File count should match", 2, statuses.size()); Collections.sort(statuses); assertEquals("File name should match", "aa", statuses.get(0).getPath().getName()); assertEquals("File name should match", "f.txt", statuses.get(1).getPath().getName()); }
@Test public void testListAllWithFilter() throws IOException { List<FileStatus> statuses = DrillFileSystemUtil.listAll(fs, new Path(base, "a"), false, new PathFilter() { @Override public boolean accept(Path path) { return path.getName().endsWith("a") || path.getName().endsWith(".txt"); } }); assertEquals("Directory and file count should match", 2, statuses.size()); Collections.sort(statuses); assertEquals("Directory name should match", "aa", statuses.get(0).getPath().getName()); assertEquals("File name should match", "f.txt", statuses.get(1).getPath().getName()); }
@Test public void testListAllRecursiveWithoutFilter() throws IOException { List<FileStatus> statuses = DrillFileSystemUtil.listAll(fs, base, true); assertEquals("Directory and file count should match", 6, statuses.size()); }
@Test public void testListAllRecursiveWithFilter() throws IOException { List<FileStatus> statuses = DrillFileSystemUtil.listAll(fs, new Path(base, "a"), true, new PathFilter() { @Override public boolean accept(Path path) { return path.getName().startsWith("a") || path.getName().endsWith(".txt"); } }); assertEquals("Directory and file count should match", 3, statuses.size()); Collections.sort(statuses); assertEquals("Directory name should match", "aa", statuses.get(0).getPath().getName()); assertEquals("File name should match", "f.txt", statuses.get(1).getPath().getName()); assertEquals("File name should match", "f.txt", statuses.get(2).getPath().getName()); }