Code example for CharArrayWriter

Methods: write, writeTo

0
     */ 
    public void test_writeToLjava_io_Writer() throws IOException { 
        cw.write("HelloWorld", 0, 10);
        StringWriter sw = new StringWriter();
        cw.writeTo(sw);
        assertEquals("Writer failed to write correct chars", "HelloWorld", sw
                .toString());
    } 
 
    /** 
     * Sets up the fixture, for example, open a network connection. This method 
     * is called before a test is executed. 
     */ 
    protected void setUp() { 
        cw = new CharArrayWriter();
    } 
 
    /** 
     * Tears down the fixture, for example, close a network connection. This 
     * method is called after a test is executed. 
     */