]> source.dussan.org Git - poi.git/commitdiff
Add test for empty constructor
authorNick Burch <nick@apache.org>
Wed, 10 May 2006 13:24:54 +0000 (13:24 +0000)
committerNick Burch <nick@apache.org>
Wed, 10 May 2006 13:24:54 +0000 (13:24 +0000)
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@405757 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextCharsAtom.java

index f2aa22114948e0616dc10fa6dd4db7753e02d20d..5c800a9ad8f10b96c1b7a607ded9c8f26e2d90ed 100644 (file)
@@ -65,7 +65,7 @@ public class TestTextCharsAtom extends TestCase {
                        assertEquals(alt_data[i],b[i]);
                }
        }
-
+       
        public void testWrite() throws Exception {
                TextCharsAtom tca = new TextCharsAtom(data,0,data.length);
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -77,4 +77,23 @@ public class TestTextCharsAtom extends TestCase {
                        assertEquals(data[i],b[i]);
                }
        }
+       
+       public void testCreateNew() throws Exception {
+               TextCharsAtom tca = new TextCharsAtom();
+               assertEquals(0, tca.getText().length());
+               
+               tca.setText(data_text);
+               assertEquals(data_text, tca.getText());
+               
+               // Check it's now like data
+               ByteArrayOutputStream baos = new ByteArrayOutputStream();
+               tca.writeOut(baos);
+               byte[] b = baos.toByteArray();
+
+               assertEquals(data.length, b.length);
+               for(int i=0; i<data.length; i++) {
+                       assertEquals(data[i],b[i]);
+               }
+       }
+
 }