问题
When I run the my unit tests, they immediatly are being terminated. However no logging is presented. (only 'Failed to start' and 'Process finished with exit code 255').
Tests worked before... JUnit 4 does not give me this problem. Test do run succesfully in Maven.
I use JUnit5 Jupiter and IntelliJ IDEA 2020.1 (Ultimate Edition).
Anyone any thoughts?
回答1:
I just had the same issue.
The single thing that fixed this - and which I could reproduce - is this: don't .close() System.out (or System.err).
@Test
void failure()
{
System.out.close();
}
makes happen what you describe.
Wherever I passed System.out to functions that would .close() their OutputStream later, I replaced them with a new ByteArrayOutputStream() instead.
来源:https://stackoverflow.com/questions/63051696/junit5-jupiter-test-terminated-in-intellij