### Question:
DrillFileSystemUtil { public static List<FileStatus> listDirectories(final FileSystem fs, Path path, boolean recursive, PathFilter... filters) throws IOException { return FileSystemUtil.listDirectories(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 testListDirectoriesWithoutFilter() throws IOException { List<FileStatus> statuses = DrillFileSystemUtil.listDirectories(fs, base, false); assertEquals("Directory count should match", 2, statuses.size()); }
@Test public void testListDirectoriesWithFilter() throws IOException { List<FileStatus> statuses = DrillFileSystemUtil.listDirectories(fs, base, false, new PathFilter() { @Override public boolean accept(Path path) { return path.getName().endsWith("a"); } }); assertEquals("Directory count should match", 1, statuses.size()); assertEquals("Directory name should match", "a", statuses.get(0).getPath().getName()); }
@Test public void testListDirectoriesRecursiveWithoutFilter() throws IOException { List<FileStatus> statuses = DrillFileSystemUtil.listDirectories(fs, base, true); assertEquals("Directory count should match", 3, statuses.size()); }
@Test public void testListDirectoriesRecursiveWithFilter() throws IOException { List<FileStatus> statuses = DrillFileSystemUtil.listDirectories(fs, base, true, new PathFilter() { @Override public boolean accept(Path path) { return path.getName().endsWith("a"); } }); assertEquals("Directory count should match", 2, statuses.size()); Collections.sort(statuses); assertEquals("Directory name should match", "a", statuses.get(0).getPath().getName()); assertEquals("Directory name should match", "aa", statuses.get(1).getPath().getName()); }