/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.commons.io.output;

import junit.framework.TestCase;

/**
 * Test {@link ProxyWriter}. 
 *
 * @version $Revision$
 */
public class ProxyWriterTest extends TestCase {

    public ProxyWriterTest(String name) {
        super(name);
    }

    /** Test writing Null String */
    public void testNullString() {

        ProxyWriter proxy = new ProxyWriter(new NullWriter());

        try {
            proxy.write((String)null);
        } catch(Exception e) {
            fail("Writing null String threw " + e);
        }

        try {
            proxy.write((String)null, 0, 0);
        } catch(Exception e) {
            fail("Writing null String threw " + e);
        }
    }

    /** Test writing Null Char array */
    public void testNullCharArray() {

        ProxyWriter proxy = new ProxyWriter(new NullWriter());

        try {
            proxy.write((char[])null);
        } catch(Exception e) {
            fail("Writing null char[] threw " + e);
        }

        try {
            proxy.write((char[])null, 0, 0);
        } catch(Exception e) {
            fail("Writing null char[] threw " + e);
        }
    }

}

@@ -1046,32 +1046,2076 @@
 r(name);%0A    %7D%0A%0A
+    /** Test Appending a CharSequence */%0A    public void testAppendCharSequence() %7B%0A        StringBuilderWriter writer = new StringBuilderWriter();%0A        ProxyWriter proxy = new ProxyWriter(writer);%0A        try %7B%0A            proxy.append(%22ABC%22);%0A        %7D catch(Exception e) %7B%0A            fail(%22Appending CharSequence threw %22 + e);%0A        %7D%0A        assertEquals(%22ABC%22, writer.toString());%0A        %0A    %7D%0A%0A    /** Test Writing a String */%0A    public void testWriteString() %7B%0A        StringBuilderWriter writer = new StringBuilderWriter();%0A        ProxyWriter proxy = new ProxyWriter(writer);%0A        try %7B%0A            proxy.write(%22ABC%22);%0A        %7D catch(Exception e) %7B%0A            fail(%22Writing String threw %22 + e);%0A        %7D%0A        assertEquals(%22ABC%22, writer.toString());%0A        %0A    %7D%0A%0A    /** Test Writing a Partial String */%0A    public void testWriteStringPartial() %7B%0A        StringBuilderWriter writer = new StringBuilderWriter();%0A        ProxyWriter proxy = new ProxyWriter(writer);%0A        try %7B%0A            proxy.write(%22ABC%22, 1, 2);%0A        %7D catch(Exception e) %7B%0A            fail(%22Writing String threw %22 + e);%0A        %7D%0A        assertEquals(%22BC%22, writer.toString());%0A        %0A    %7D%0A%0A    /** Test Writing a Char array */%0A    public void testWriteCharArray() %7B%0A        StringBuilderWriter writer = new StringBuilderWriter();%0A        ProxyWriter proxy = new ProxyWriter(writer);%0A        try %7B%0A            proxy.write(new char%5B%5D %7B'A', 'B', 'C'%7D);%0A        %7D catch(Exception e) %7B%0A            fail(%22Writing char%5B%5D threw %22 + e);%0A        %7D%0A        assertEquals(%22ABC%22, writer.toString());%0A        %0A    %7D%0A%0A    /** Test Writing a Partial Char array */%0A    public void testWriteCharArrayPartial() %7B%0A        StringBuilderWriter writer = new StringBuilderWriter();%0A        ProxyWriter proxy = new ProxyWriter(writer);%0A        try %7B%0A            proxy.write(new char%5B%5D %7B'A', 'B', 'C'%7D, 1, 2);%0A        %7D catch(Exception e) %7B%0A            fail(%22Writing char%5B%5D threw %22 + e);%0A        %7D%0A        assertEquals(%22BC%22, writer.toString());%0A        %0A    %7D%0A    %0A
     /** Test wri
@@ -3989,10 +3989,323 @@
 %0A    %7D%0A%0A
+    /** Test appending Null CharSequence */%0A    public void testNullCharSequencec() %7B%0A%0A        ProxyWriter proxy = new ProxyWriter(new NullWriter());%0A%0A        try %7B%0A            proxy.append((String)null);%0A        %7D catch(Exception e) %7B%0A            fail(%22Appending null CharSequence threw %22 + e);%0A        %7D%0A    %7D%0A%0A
 %7D%0A

Add a few more tests