Code example for CharArrayWriter

Methods: appendcloseflushtoString

0
    public void test_appendCharSequence() { 
        String testString = "My Test String";
        CharArrayWriter writer = new CharArrayWriter(10);
        writer.append(testString);
        writer.flush();
        assertEquals(testString, writer.toString());
        writer.close();
    } 
 
    /** 
     * @tests java.io.CharArrayWriter#append(CharSequence, int, int) 
     */ 
    public void test_appendCharSequenceIntInt() { 
        String testString = "My Test String";
        CharArrayWriter writer = new CharArrayWriter(10);
        writer.append(testString, 1, 3);
        writer.flush();
        assertEquals(testString.substring(1, 3), writer.toString());
        writer.close();
    } 
Stop searching for code, let great code find you!  Add Codota to your java IDE