Code example for CharArrayWriter

Methods: size

0
    CharArrayWriter cw;
    CharArrayReader cr;
 
    public void test_ConstructorI() { 
        // Test for method java.io.CharArrayWriter(int) 
        cw = new CharArrayWriter(90);
        assertEquals("Test 1: Incorrect writer created.", 0, cw.size());
 
        try { 
            cw = new CharArrayWriter(-1);
            fail("IllegalArgumentException expected.");
        } catch (IllegalArgumentException e) {
            // Expected. 
        } 
    } 
 
    public void test_write$CII_Exception() { 
        char[] target = new char[10];
        cw = new CharArrayWriter();
        try { 
            cw.write(target, -1, 1);