### Question:
SnapshotLogCleaner extends BaseLogCleanerDelegate { @Override public void setConf(Configuration conf) { super.setConf(conf); try { long cacheRefreshPeriod = conf.getLong( HLOG_CACHE_REFRESH_PERIOD_CONF_KEY, DEFAULT_HLOG_CACHE_REFRESH_PERIOD); final FileSystem fs = FSUtils.getCurrentFileSystem(conf); Path rootDir = FSUtils.getRootDir(conf); cache = new SnapshotFileCache(fs, rootDir, cacheRefreshPeriod, cacheRefreshPeriod, "snapshot-log-cleaner-cache-refresher", new SnapshotFileCache.SnapshotFileInspector() { public Collection<String> filesUnderSnapshot(final Path snapshotDir) throws IOException { return SnapshotReferenceUtil.getHLogNames(fs, snapshotDir); } }); } catch (IOException e) { LOG.error("Failed to create snapshot log cleaner", e); } }  @Override synchronized boolean isLogDeletable(Path filePath); @Override void setConf(Configuration conf); @Override void stop(String why); @Override boolean isStopped();  }### Answer:
@Test public void testFindsSnapshotFilesWhenCleaning() throws IOException { Configuration conf = TEST_UTIL.getConfiguration(); FSUtils.setRootDir(conf, TEST_UTIL.getDataTestDir()); Path rootDir = FSUtils.getRootDir(conf); FileSystem fs = FileSystem.get(conf); SnapshotLogCleaner cleaner = new SnapshotLogCleaner(); cleaner.setConf(conf); String snapshotName = "snapshot"; byte[] snapshot = Bytes.toBytes(snapshotName); Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshotName, rootDir); Path snapshotLogDir = new Path(snapshotDir, HConstants.HREGION_LOGDIR_NAME); String timestamp = "1339643343027"; String hostFromMaster = "localhost%2C59648%2C1339643336601"; Path hostSnapshotLogDir = new Path(snapshotLogDir, hostFromMaster); String snapshotlogfile = hostFromMaster + "." + timestamp + ".hbase"; fs.create(new Path(hostSnapshotLogDir, snapshotlogfile)); Path oldlogDir = new Path(rootDir, ".oldlogs"); Path logFile = new Path(oldlogDir, snapshotlogfile); fs.create(logFile); assertFalse(cleaner.isFileDeletable(logFile)); }