Im trying to make a test in JUnit where I want to test if the console prints out the message I want it to print. The code looks like this:
public class MainTestingClass extends TestCase {
    private final ByteArrayOutputStream outContent = new ByteArrayOutputStream();
    @Before
    public void setUpStreams() {
        System.setOut(new PrintStream(outContent));
    }
    @After
    public void cleanUpStreams() {
        System.setOut(null);
    }
    @Test
    public void testPracticalViewConsole() {
        PracticalView view = new PracticalView();
        view.PrintResults();
        assertEquals("welcome to the macro counting app", outContent.toString());
    }
}
but for some reason the system.out still prints to the console and in the test i get:
junit.framework.ComparisonFailure: Expected :welcome to the macro counting app Actual :
And I have no idea what the problem is.
 
     
     
    