Code example for Console

Methods: readPassword

0
 
    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 { 
            console.readPassword();
            fail();
        } catch (IOError expected) {
        } 
    } 
 
    public void test_readPassword_LString_LObject() { 
        try { 
            console.readPassword("%d", 3);
            fail();
        } catch (IOError expected){
        } 
        String prompt = new String(((ByteArrayOutputStream)out).toByteArray());
        assertEquals("3", prompt);
    }