### Question:
LogFileUtils { public static String getFilePathByInode(LogStream logStream, long inode) throws IOException { String result = null; String logDir = logStream.getLogDir(); File dir = new File(logDir); if (dir.exists()) { SingerLogConfig logConfig = logStream.getSingerLog().getSingerLogConfig(); String regexStr = logStream.getFileNamePrefix(); if (logConfig.getFilenameMatchMode() == FileNameMatchMode.PREFIX) { regexStr += ".*"; } LOG.info("Matching files under {} with filter {}", logDir, regexStr); FileFilter fileFilter = new RegexFileFilter(regexStr); File[] files = dir.listFiles(fileFilter); for (File file : files) { String path = file.getAbsolutePath(); if (inode == SingerUtils.getFileInode(path)) { result = path; break; } } } return result; } private  LogFileUtils(); static String getFilePathByInode(LogStream logStream, long inode);  }### Answer:
@Test public void testGetFilePathByInode() throws Exception { String logFilePath = FilenameUtils.concat(getTempPath(), "thrift.log"); SingerLog singerLog = new SingerLog( new SingerLogConfig("test", getTempPath(), "thrift.log", null, null, null)); singerLog.getSingerLogConfig().setFilenameMatchMode(FileNameMatchMode.PREFIX); LogStream logStream = new LogStream(singerLog, "thrift.log"); createLogFiles(logFilePath); File logDir = new File(getTempPath()); File[] logFiles = logDir.listFiles(); for (File file : logFiles) { if (file.isDirectory()) continue; long inode = SingerUtils.getFileInode(file.toPath()); String path = LogFileUtils.getFilePathByInode(logStream, inode); assertEquals(path, file.getAbsolutePath()); } }