### Question:
LogFileReader { public static List<String> readAllLines(Path logFilePath) { if(logFilePath == null ) { logger.warn("传入的文件路径是 null"); return Collections.emptyList(); } if(!logFilePath.toFile().exists()) { logger.warn("日志文件 {0} 不存在", logFilePath.toString()); return Collections.emptyList(); } try { return Files.readAllLines(logFilePath); } catch (IOException e) { logger.warn("获取文件内容失败", e); } return Collections.emptyList(); }  static List<String> readAllLines(Path logFilePath);  }### Answer:
@Test public void read_all_lines_then_no_log_file() throws IOException { assertThat(LogFileReader.readAllLines(null)).isEmpty(); assertThat(LogFileReader.readAllLines(Paths.get("not-exist.file"))).isEmpty(); }
@Test public void read_all_lines_then_full_content(@TempDir Path tempFolder) throws IOException { Path logFile = Files.createFile(tempFolder.resolve("a.log")); Files.write(logFile, Arrays.asList("a", "b", "c"), StandardOpenOption.APPEND); List<String> content = LogFileReader.readAllLines(logFile); assertThat(content).hasSize(3); assertThat(content.get(0)).isEqualTo("a"); assertThat(content.get(1)).isEqualTo("b"); assertThat(content.get(2)).isEqualTo("c"); }