预期输出和实际输出的内容相同,但我得到 org.opentest4j.AssertionFailedError
我试图用所有替换/n,System.lineSeparator()但我得到的输出是:“内容仅在行分隔符中存在差异”
@BeforeEach
public void setUpStreamsAndEmptyFile() {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
// emptying file contents
try {
PrintWriter pw = new PrintWriter(filePath);
pw.close();
} catch (FileNotFoundException e) {
System.out.println(e.getMessage());
}
}
@AfterEach
public void restoreStreams() {
System.setOut(originalOut);
System.setErr(originalErr);
}
@Test
public void executeCreateEventCommand() {
String expected = "\t Got it. I've added this task: " + System.lineSeparator() +
"\t [Event][?] Project Meeting (at: 28/08/19 1600 - 28/08/19 1800)" + System.lineSeparator() +
"\t Now you …Run Code Online (Sandbox Code Playgroud)