From: Nick Burch Date: Wed, 10 May 2006 13:24:54 +0000 (+0000) Subject: Add test for empty constructor X-Git-Tag: REL_3_0_ALPHA3~104 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c569ba02e60d3abc79a895ad3921e488e922bed7;p=poi.git Add test for empty constructor git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@405757 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextCharsAtom.java b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextCharsAtom.java index f2aa221149..5c800a9ad8 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextCharsAtom.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/record/TestTextCharsAtom.java @@ -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