将文本文件与 Junit 进行比较
2022-08-31 20:22:34
我正在使用以下内容比较 junit 中的文本文件:
public static void assertReaders(BufferedReader expected,
BufferedReader actual) throws IOException {
String line;
while ((line = expected.readLine()) != null) {
assertEquals(line, actual.readLine());
}
assertNull("Actual had more lines then the expected.", actual.readLine());
assertNull("Expected had more lines then the actual.", expected.readLine());
}
这是比较文本文件的好方法吗?什么是首选?