Code example for Console

Methods: printf

0
        assertEquals("1 hello", prompt);
    } 
 
    public void test_printf_LString_LObject() { 
        Calendar c = new GregorianCalendar(1983, 2, 21);
        assertSame(console, console.printf("%1$tm %1$te,%1$tY", c));
        String prompt = new String(((ByteArrayOutputStream)out).toByteArray());
        assertEquals("03 21,1983", prompt);
    } 
 
    public void test_reader() throws IOException { 
        Reader reader1 = console.reader();
        assertTrue(reader1.ready());
        Reader reader2 = console.reader();
        assertSame(reader1, reader2);
    } 
 
    public void test_readLine() { 
        String line = console.readLine();
        assertEquals("hello world", line);
    }