Code example for Console

Methods: readLine

        Reader reader2 = console.reader();
        assertSame(reader1, reader2);
    public void test_readLine() { 
        String line = console.readLine();
        assertEquals("hello world", line);
    public void test_readLine_LString_LObject() { 
        String line = console.readLine("%d %s", 2, "Please input a line of string to test:");
        assertEquals("hello world", line);
        String prompt = new String(((ByteArrayOutputStream)out).toByteArray());
        assertEquals("2 Please input a line of string to test:", prompt);
    public void test_readPassword() { 
        // Since we cannot set the echo off by using the mock input and output 
        // stream, so IOException will be thrown. 
        try {