只想测试是否按预期读取了以下文件:
first
second
但为什么我的测试失败了:
@Test
public void testReadFileTwoRows() {
File f = new File(FILE_WITH_TWO_ROWS);
String fileCont = "";
String expCont = "first\nsecond";
try {
fileCont = ImportUtil.readFile(f);
} catch (IOException e) {
fail("File couldn't be read");
}
assertEquals("File was not properly read", fileCont, expCont);
}
我认为它与“\ n”有关,但我没有看到另一种方法来编写该检查。
非常感谢