获取输出out路径
this.getClass().getProtectionDomain().getCodeSource().getLocation().toURI().getPath()
读取文件
//File File file = new File(this.getClass().getResource("/line_counter_test.txt.gz").toURI()); //Stream InputStream in = this.getClass().getResourceAsStream("/line_counter_test.txt”);
统计文件大小--不支持压缩文件
//统计文件行数,效率慢,且只能获取非压缩文件 Files.lines(Paths.get(new File("e://test.fa").getPath())).count();
对比文件内容--不支持压缩文件
//对比文件内容 assertTrue(FileUtils.contentEquals(resourceFile, resultFile));
原文:https://www.cnblogs.com/anna-blog/p/12621242.html