### Question:
FSVisitor { public static void visitLogFiles(final FileSystem fs, final Path rootDir, final LogFileVisitor visitor) throws IOException { Path logsDir = new Path(rootDir, HConstants.HREGION_LOGDIR_NAME); FileStatus[] logServerDirs = FSUtils.listStatus(fs, logsDir); if (logServerDirs == null) { LOG.info("No logs under directory:" + logsDir); return; } for (FileStatus serverLogs: logServerDirs) { String serverName = serverLogs.getPath().getName(); FileStatus[] hlogs = FSUtils.listStatus(fs, serverLogs.getPath()); if (hlogs == null) { LOG.debug("No hfiles found for server: " + serverName + ", skipping."); continue; } for (FileStatus hlogRef: hlogs) { visitor.logFile(serverName, hlogRef.getPath().getName()); } } } private  FSVisitor(); static void visitTableStoreFiles(final FileSystem fs, final Path tableDir,
      final StoreFileVisitor visitor); static void visitRegionStoreFiles(final FileSystem fs, final Path regionDir,
      final StoreFileVisitor visitor); static void visitTableRecoveredEdits(final FileSystem fs, final Path tableDir,
      final FSVisitor.RecoveredEditsVisitor visitor); static void visitRegionRecoveredEdits(final FileSystem fs, final Path regionDir,
      final FSVisitor.RecoveredEditsVisitor visitor); static void visitLogFiles(final FileSystem fs, final Path rootDir,
      final LogFileVisitor visitor);  }### Answer:
@Test public void testVisitLogFiles() throws IOException { final Set<String> servers = new HashSet<String>(); final Set<String> logs = new HashSet<String>(); FSVisitor.visitLogFiles(fs, rootDir, new FSVisitor.LogFileVisitor() { public void logFile (final String server, final String logfile) throws IOException { servers.add(server); logs.add(logfile); } }); assertEquals(regionServers, servers); assertEquals(serverLogs, logs); }