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 ?
Do you need to do it programatically ? In Eclipse, go to Run->Run Configurations... Select your application in the list, go to Common/Standard Input and Output, and select the file you want the standard output to redirected to. Of course, this will only work for applications launched within Eclipse.