Author: niallp
Date: Wed Apr 14 17:51:23 2010
New Revision: 934053

URL: http://svn.apache.org/viewvc?rev=934053&view=rev
Log:
Add a few more tests

Modified:
    
commons/proper/io/trunk/src/test/org/apache/commons/io/output/ProxyWriterTest.java

Modified: 
commons/proper/io/trunk/src/test/org/apache/commons/io/output/ProxyWriterTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/org/apache/commons/io/output/ProxyWriterTest.java?rev=934053&r1=934052&r2=934053&view=diff
==============================================================================
--- 
commons/proper/io/trunk/src/test/org/apache/commons/io/output/ProxyWriterTest.java
 (original)
+++ 
commons/proper/io/trunk/src/test/org/apache/commons/io/output/ProxyWriterTest.java
 Wed Apr 14 17:51:23 2010
@@ -29,6 +29,71 @@ public class ProxyWriterTest extends Tes
         super(name);
     }
 
+    /** Test Appending a CharSequence */
+    public void testAppendCharSequence() {
+        StringBuilderWriter writer = new StringBuilderWriter();
+        ProxyWriter proxy = new ProxyWriter(writer);
+        try {
+            proxy.append("ABC");
+        } catch(Exception e) {
+            fail("Appending CharSequence threw " + e);
+        }
+        assertEquals("ABC", writer.toString());
+        
+    }
+
+    /** Test Writing a String */
+    public void testWriteString() {
+        StringBuilderWriter writer = new StringBuilderWriter();
+        ProxyWriter proxy = new ProxyWriter(writer);
+        try {
+            proxy.write("ABC");
+        } catch(Exception e) {
+            fail("Writing String threw " + e);
+        }
+        assertEquals("ABC", writer.toString());
+        
+    }
+
+    /** Test Writing a Partial String */
+    public void testWriteStringPartial() {
+        StringBuilderWriter writer = new StringBuilderWriter();
+        ProxyWriter proxy = new ProxyWriter(writer);
+        try {
+            proxy.write("ABC", 1, 2);
+        } catch(Exception e) {
+            fail("Writing String threw " + e);
+        }
+        assertEquals("BC", writer.toString());
+        
+    }
+
+    /** Test Writing a Char array */
+    public void testWriteCharArray() {
+        StringBuilderWriter writer = new StringBuilderWriter();
+        ProxyWriter proxy = new ProxyWriter(writer);
+        try {
+            proxy.write(new char[] {'A', 'B', 'C'});
+        } catch(Exception e) {
+            fail("Writing char[] threw " + e);
+        }
+        assertEquals("ABC", writer.toString());
+        
+    }
+
+    /** Test Writing a Partial Char array */
+    public void testWriteCharArrayPartial() {
+        StringBuilderWriter writer = new StringBuilderWriter();
+        ProxyWriter proxy = new ProxyWriter(writer);
+        try {
+            proxy.write(new char[] {'A', 'B', 'C'}, 1, 2);
+        } catch(Exception e) {
+            fail("Writing char[] threw " + e);
+        }
+        assertEquals("BC", writer.toString());
+        
+    }
+    
     /** Test writing Null String */
     public void testNullString() {
 
@@ -65,4 +130,16 @@ public class ProxyWriterTest extends Tes
         }
     }
 
+    /** Test appending Null CharSequence */
+    public void testNullCharSequencec() {
+
+        ProxyWriter proxy = new ProxyWriter(new NullWriter());
+
+        try {
+            proxy.append((String)null);
+        } catch(Exception e) {
+            fail("Appending null CharSequence threw " + e);
+        }
+    }
+
 }


Reply via email to