Code example for PrintStream

0
        } 
    } 
 
    public void testSingle() throws Exception { 
        TestRunner t = new TestRunner();
        t.setPrinter(new ResultPrinter(new PrintStream(new ByteArrayOutputStream())));
        String[] args = {
                "-m", "junit.tests.runner.TextRunnerSingleMethodTest$InvocationTest.testWasInvoked" 
        }; 
        fgWasInvoked = false;
        t.start(args);
        assertTrue(fgWasInvoked);
    } 
 
}