Unable to redirect all the eclipse console logs to buffer
I need to assert some string present in the console logs. I tried the below code to redirect the console logs to buffer. However, still some part of the code goes to console logs and I am unable to assert it programatically. Could someone help me here ?
System.setOut( new PrintStream(new ByteArrayOutputStream()));
Re: Unable to redirect all the eclipse console logs to buffer
Assertions and exceptions are sent to the Error stream, so if you are looking to assert these you should also set the error stream:
Code :
System.setErr( new PrintStream(new ByteArrayOutputStream()));
Re: Unable to redirect all the eclipse console logs to buffer