-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
SystemErrRule fails to detect logged lines if it is being used in more than one junit test #51
Comments
Your description does not contain enough information for providing you help. Can you show me the code that writes to |
Output to |
I think that Logback gets a reference to the original |
The approach you are suggesting is not robust. |
I have this same problem, and it indeed happens because the logger has the original I have come along the suggestion to check the logger instead, but I consider that only as a dirty workaround, because I need to test my codes output to the OS, not what reaches the logger. The logger implementation can change, it might reach the logger but not get output, it might get formatted wrong by the logger, might be printed to the wrong stream, ... .. PS: thanks for the awesome library.. helps a lot! :-) |
I have a simple test, where I define a SystemErrRule as following:
Then I have 2 unit tests, where in each of them I test if there were lines dumped into system err.
Only first JUnit test succeeds, the second one fails with:
I'm using
sl4j-simple
as a dependency:testCompile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.16'
How do I fix it?
The text was updated successfully, but these errors were encountered: