]> source.dussan.org Git - poi.git/commitdiff
Fixes to ddf junits after r776424
authorJosh Micich <josh@apache.org>
Wed, 20 May 2009 00:32:42 +0000 (00:32 +0000)
committerJosh Micich <josh@apache.org>
Wed, 20 May 2009 00:32:42 +0000 (00:32 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@776507 13f79535-47bb-0310-9956-ffa450edef68

src/testcases/org/apache/poi/ddf/TestEscherBSERecord.java
src/testcases/org/apache/poi/ddf/TestEscherContainerRecord.java
src/testcases/org/apache/poi/ddf/TestEscherDgRecord.java
src/testcases/org/apache/poi/ddf/TestEscherDggRecord.java
src/testcases/org/apache/poi/ddf/TestEscherSpgrRecord.java
src/testcases/org/apache/poi/ddf/TestEscherSplitMenuColorsRecord.java
src/testcases/org/apache/poi/ddf/TestUnknownEscherRecord.java

index 7db08a34a62af8b08d5a880884dcb01e2f33219e..b67b46540b9117f7bf38ac582f2bcd61c1a8b4c9 100644 (file)
@@ -1,4 +1,3 @@
-
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
+
 package org.apache.poi.ddf;
 
 import junit.framework.TestCase;
 import org.apache.poi.util.HexDump;
 import org.apache.poi.util.HexRead;
 
-import java.io.IOException;
-
-public class TestEscherBSERecord extends TestCase
-{
-    public void testFillFields() throws Exception
-    {
+public final class TestEscherBSERecord extends TestCase {
+    public void testFillFields() {
         String data = "01 00 00 00 24 00 00 00 05 05 01 02 03 04 " +
                 " 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 00 00 00 " +
                 " 00 00 02 00 00 00 03 00 00 00 04 05 06 07";
@@ -48,8 +43,7 @@ public class TestEscherBSERecord extends TestCase
         assertEquals( 0, r.getRemainingData().length );
     }
 
-    public void testSerialize() throws Exception
-    {
+    public void testSerialize() {
         EscherBSERecord r = createRecord();
 
         byte[] data = new byte[8 + 36];
@@ -58,12 +52,11 @@ public class TestEscherBSERecord extends TestCase
         assertEquals( "[01, 00, 00, 00, 24, 00, 00, 00, 05, 05, 01, 02, 03, 04, " +
                 "05, 06, 07, 08, 09, 0A, 0B, 0C, 0D, 0E, 0F, 00, 01, 00, 00, 00, " +
                 "00, 00, 02, 00, 00, 00, 03, 00, 00, 00, 04, 05, 06, 07]",
-                HexDump.toHex( data ) );
+                HexDump.toHex(data));
 
     }
 
-    private EscherBSERecord createRecord() throws IOException
-    {
+    private EscherBSERecord createRecord() {
         EscherBSERecord r = new EscherBSERecord();
         r.setOptions( (short) 0x0001 );
         r.setBlipTypeWin32( EscherBSERecord.BT_JPEG );
@@ -81,27 +74,27 @@ public class TestEscherBSERecord extends TestCase
 
     }
 
-    public void testToString() throws Exception
-    {
+    public void testToString() {
         EscherBSERecord record = createRecord();
-        String nl = System.getProperty("line.separator");
-        assertEquals( "org.apache.poi.ddf.EscherBSERecord:" + nl +
-                "  RecordId: 0xF007" + nl +
-                "  Options: 0x0001" + nl +
-                "  BlipTypeWin32: 5" + nl +
-                "  BlipTypeMacOS: 5" + nl +
-                "  SUID: [01, 02, 03, 04, 05, 06, 07, 08, 09, 0A, 0B, 0C, 0D, 0E, 0F, 00]" + nl +
-                "  Tag: 1" + nl +
-                "  Size: 0" + nl +
-                "  Ref: 2" + nl +
-                "  Offset: 3" + nl +
-                "  Usage: 4" + nl +
-                "  Name: 5" + nl +
-                "  Unused2: 6" + nl +
-                "  Unused3: 7" + nl +
-                               "  blipRecord: null" + nl +
-                "  Extra Data:" + nl +
-                "No Data" + nl, record.toString() );
+        String expected = "org.apache.poi.ddf.EscherBSERecord:" + '\n' +
+                "  RecordId: 0xF007" + '\n' +
+                "  Options: 0x0001" + '\n' +
+                "  BlipTypeWin32: 5" + '\n' +
+                "  BlipTypeMacOS: 5" + '\n' +
+                "  SUID: [01, 02, 03, 04, 05, 06, 07, 08, 09, 0A, 0B, 0C, 0D, 0E, 0F, 00]" + '\n' +
+                "  Tag: 1" + '\n' +
+                "  Size: 0" + '\n' +
+                "  Ref: 2" + '\n' +
+                "  Offset: 3" + '\n' +
+                "  Usage: 4" + '\n' +
+                "  Name: 5" + '\n' +
+                "  Unused2: 6" + '\n' +
+                "  Unused3: 7" + '\n' +
+                "  blipRecord: null" + '\n' +
+                "  Extra Data:" + '\n' +
+                ": 0";
+        String actual = record.toString();
+        assertEquals( expected, actual );
     }
 
 }
index 8d12b1c51674489a9512c319b5e9bd628e9586d1..4d83cad4468c3e43c5933bda223dd3825dd6b7e3 100644 (file)
@@ -14,7 +14,7 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
+
 package org.apache.poi.ddf;
 
 import java.io.File;
@@ -31,166 +31,166 @@ import org.apache.poi.util.IOUtils;
  */
 public final class TestEscherContainerRecord extends TestCase {
        private String ESCHER_DATA_PATH;
-       
+
        protected void setUp() {
                ESCHER_DATA_PATH = System.getProperty("DDF.testdata.path");
        }
 
        public void testFillFields() {
-        EscherRecordFactory f = new DefaultEscherRecordFactory();
-        byte[] data = HexRead.readFromString( "0F 02 11 F1 00 00 00 00" );
-        EscherRecord r = f.createRecord( data, 0 );
-        r.fillFields( data, 0, f );
-        assertTrue( r instanceof EscherContainerRecord );
-        assertEquals( (short) 0x020F, r.getOptions() );
-        assertEquals( (short) 0xF111, r.getRecordId() );
-
-        data = HexRead.readFromString( "0F 02 11 F1 08 00 00 00" +
-                " 02 00 22 F2 00 00 00 00" );
-        r = f.createRecord( data, 0 );
-        r.fillFields( data, 0, f );
-        EscherRecord c = r.getChild( 0 );
-        assertFalse( c instanceof EscherContainerRecord );
-        assertEquals( (short) 0x0002, c.getOptions() );
-        assertEquals( (short) 0xF222, c.getRecordId() );
-    }
-
-    public void testSerialize() {
-        UnknownEscherRecord r = new UnknownEscherRecord();
-        r.setOptions( (short) 0x123F );
-        r.setRecordId( (short) 0xF112 );
-        byte[] data = new byte[8];
-        r.serialize( 0, data, new NullEscherSerializationListener() );
-
-        assertEquals( "[3F, 12, 12, F1, 00, 00, 00, 00]", HexDump.toHex( data ) );
-
-        EscherRecord childRecord = new UnknownEscherRecord();
-        childRecord.setOptions( (short) 0x9999 );
-        childRecord.setRecordId( (short) 0xFF01 );
-        r.addChildRecord( childRecord );
-        data = new byte[16];
-        r.serialize( 0, data, new NullEscherSerializationListener() );
-
-        assertEquals( "[3F, 12, 12, F1, 08, 00, 00, 00, 99, 99, 01, FF, 00, 00, 00, 00]", HexDump.toHex( data ) );
-
-    }
-
-    public void testToString() {
-        EscherContainerRecord r = new EscherContainerRecord();
-        r.setRecordId( EscherContainerRecord.SP_CONTAINER );
-        r.setOptions( (short) 0x000F );
-        String nl = System.getProperty( "line.separator" );
-        assertEquals( "org.apache.poi.ddf.EscherContainerRecord (SpContainer):" + nl +
-                "  isContainer: true" + nl +
-                "  options: 0x000F" + nl +
-                "  recordId: 0xF004" + nl +
-                "  numchildren: 0" + nl
-                , r.toString() );
-
-        EscherOptRecord r2 = new EscherOptRecord();
-        r2.setOptions( (short) 0x9876 );
-        r2.setRecordId( EscherOptRecord.RECORD_ID );
-
-        String expected;
-        r.addChildRecord( r2 );
-        expected = "org.apache.poi.ddf.EscherContainerRecord (SpContainer):" + nl +
-                   "  isContainer: true" + nl +
-                   "  options: 0x000F" + nl +
-                   "  recordId: 0xF004" + nl +
-                   "  numchildren: 1" + nl +
-                   "  children: " + nl +
-                   "   Child 0:" + nl +
-                   "org.apache.poi.ddf.EscherOptRecord:" + nl +
-                   "  isContainer: false" + nl +
-                   "  options: 0x0003" + nl +
-                   "  recordId: 0xF00B" + nl +
-                   "  numchildren: 0" + nl +
-                   "  properties:" + nl;
-        assertEquals( expected, r.toString() );
-
-        r.addChildRecord( r2 );
-        expected = "org.apache.poi.ddf.EscherContainerRecord (SpContainer):" + nl +
-                   "  isContainer: true" + nl +
-                   "  options: 0x000F" + nl +
-                   "  recordId: 0xF004" + nl +
-                   "  numchildren: 2" + nl +
-                   "  children: " + nl +
-                   "   Child 0:" + nl +
-                   "org.apache.poi.ddf.EscherOptRecord:" + nl +
-                   "  isContainer: false" + nl +
-                   "  options: 0x0003" + nl +
-                   "  recordId: 0xF00B" + nl +
-                   "  numchildren: 0" + nl +
-                   "  properties:" + nl +
-                   "   Child 1:" + nl +
-                   "org.apache.poi.ddf.EscherOptRecord:" + nl +
-                   "  isContainer: false" + nl +
-                   "  options: 0x0003" + nl +
-                   "  recordId: 0xF00B" + nl +
-                   "  numchildren: 0" + nl +
-                   "  properties:" + nl;
-        assertEquals( expected, r.toString() );
-    }
-    
-    private static final class DummyEscherRecord extends EscherRecord {
-       public DummyEscherRecord() { }
-        public int fillFields( byte[] data, int offset, EscherRecordFactory recordFactory ) { return 0; }
-        public int serialize( int offset, byte[] data, EscherSerializationListener listener ) { return 0; }
-        public int getRecordSize() { return 10; }
-        public String getRecordName() { return ""; }
-    }
-
-    public void testGetRecordSize() {
-        EscherContainerRecord r = new EscherContainerRecord();
-        r.addChildRecord(new DummyEscherRecord());
-        assertEquals(18, r.getRecordSize());
-    }
-
-    /**
-     * We were having problems with reading too much data on an UnknownEscherRecord,
-     *  but hopefully we now read the correct size.
-     */
-    public void testBug44857() throws Exception {
-       File f = new File(ESCHER_DATA_PATH, "Container.dat");
-       assertTrue(f.exists());
-       
-       FileInputStream finp = new FileInputStream(f);
-       byte[] data = IOUtils.toByteArray(finp);
-       
-       // This used to fail with an OutOfMemory
-       EscherContainerRecord record = new EscherContainerRecord();
-       record.fillFields(data, 0, new DefaultEscherRecordFactory());
-    }
-    
-    /**
-     * Ensure {@link EscherContainerRecord} doesn't spill its guts everywhere
-     */
-    public void testChildren() {
-       EscherContainerRecord ecr = new EscherContainerRecord();
-       List<EscherRecord> children0 = ecr.getChildRecords();
-       assertEquals(0, children0.size());
-
-       EscherRecord chA = new DummyEscherRecord();
-       EscherRecord chB = new DummyEscherRecord();
-       EscherRecord chC = new DummyEscherRecord();
-       
-       ecr.addChildRecord(chA);
-       ecr.addChildRecord(chB);
-       children0.add(chC);
-       
-       List<EscherRecord> children1 = ecr.getChildRecords();
-       assertTrue(children0 !=  children1);
-       assertEquals(2, children1.size());
-       assertEquals(chA, children1.get(0));
-       assertEquals(chB, children1.get(1));
-       
-       assertEquals(1, children0.size()); // first copy unchanged
-       
-       ecr.setChildRecords(children0);
-       ecr.addChildRecord(chA);
-       List<EscherRecord> children2 = ecr.getChildRecords();
-       assertEquals(2, children2.size());
-       assertEquals(chC, children2.get(0));
-       assertEquals(chA, children2.get(1));
+               EscherRecordFactory f = new DefaultEscherRecordFactory();
+               byte[] data = HexRead.readFromString("0F 02 11 F1 00 00 00 00");
+               EscherRecord r = f.createRecord(data, 0);
+               r.fillFields(data, 0, f);
+               assertTrue(r instanceof EscherContainerRecord);
+               assertEquals((short) 0x020F, r.getOptions());
+               assertEquals((short) 0xF111, r.getRecordId());
+
+               data = HexRead.readFromString("0F 02 11 F1 08 00 00 00" +
+                               " 02 00 22 F2 00 00 00 00");
+               r = f.createRecord(data, 0);
+               r.fillFields(data, 0, f);
+               EscherRecord c = r.getChild(0);
+               assertFalse(c instanceof EscherContainerRecord);
+               assertEquals((short) 0x0002, c.getOptions());
+               assertEquals((short) 0xF222, c.getRecordId());
+       }
+
+       public void testSerialize() {
+               UnknownEscherRecord r = new UnknownEscherRecord();
+               r.setOptions((short) 0x123F);
+               r.setRecordId((short) 0xF112);
+               byte[] data = new byte[8];
+               r.serialize(0, data, new NullEscherSerializationListener());
+
+               assertEquals("[3F, 12, 12, F1, 00, 00, 00, 00]", HexDump.toHex(data));
+
+               EscherRecord childRecord = new UnknownEscherRecord();
+               childRecord.setOptions((short) 0x9999);
+               childRecord.setRecordId((short) 0xFF01);
+               r.addChildRecord(childRecord);
+               data = new byte[16];
+               r.serialize(0, data, new NullEscherSerializationListener());
+
+               assertEquals("[3F, 12, 12, F1, 08, 00, 00, 00, 99, 99, 01, FF, 00, 00, 00, 00]", HexDump.toHex(data));
+
+       }
+
+       public void testToString() {
+               EscherContainerRecord r = new EscherContainerRecord();
+               r.setRecordId(EscherContainerRecord.SP_CONTAINER);
+               r.setOptions((short) 0x000F);
+               String nl = System.getProperty("line.separator");
+               assertEquals("org.apache.poi.ddf.EscherContainerRecord (SpContainer):" + nl +
+                               "  isContainer: true" + nl +
+                               "  options: 0x000F" + nl +
+                               "  recordId: 0xF004" + nl +
+                               "  numchildren: 0" + nl
+                               , r.toString());
+
+               EscherOptRecord r2 = new EscherOptRecord();
+               r2.setOptions((short) 0x9876);
+               r2.setRecordId(EscherOptRecord.RECORD_ID);
+
+               String expected;
+               r.addChildRecord(r2);
+               expected = "org.apache.poi.ddf.EscherContainerRecord (SpContainer):" + nl +
+                                  "  isContainer: true" + nl +
+                                  "  options: 0x000F" + nl +
+                                  "  recordId: 0xF004" + nl +
+                                  "  numchildren: 1" + nl +
+                                  "  children: " + nl +
+                                  "   Child 0:" + nl +
+                                  "org.apache.poi.ddf.EscherOptRecord:" + nl +
+                                  "  isContainer: false" + nl +
+                                  "  options: 0x0003" + nl +
+                                  "  recordId: 0xF00B" + nl +
+                                  "  numchildren: 0" + nl +
+                                  "  properties:" + nl;
+               assertEquals(expected, r.toString());
+
+               r.addChildRecord(r2);
+               expected = "org.apache.poi.ddf.EscherContainerRecord (SpContainer):" + nl +
+                                  "  isContainer: true" + nl +
+                                  "  options: 0x000F" + nl +
+                                  "  recordId: 0xF004" + nl +
+                                  "  numchildren: 2" + nl +
+                                  "  children: " + nl +
+                                  "   Child 0:" + nl +
+                                  "org.apache.poi.ddf.EscherOptRecord:" + nl +
+                                  "  isContainer: false" + nl +
+                                  "  options: 0x0003" + nl +
+                                  "  recordId: 0xF00B" + nl +
+                                  "  numchildren: 0" + nl +
+                                  "  properties:" + nl +
+                                  "   Child 1:" + nl +
+                                  "org.apache.poi.ddf.EscherOptRecord:" + nl +
+                                  "  isContainer: false" + nl +
+                                  "  options: 0x0003" + nl +
+                                  "  recordId: 0xF00B" + nl +
+                                  "  numchildren: 0" + nl +
+                                  "  properties:" + nl;
+               assertEquals(expected, r.toString());
+       }
+
+       private static final class DummyEscherRecord extends EscherRecord {
+               public DummyEscherRecord() { }
+               public int fillFields(byte[] data, int offset, EscherRecordFactory recordFactory) { return 0; }
+               public int serialize(int offset, byte[] data, EscherSerializationListener listener) { return 0; }
+               public int getRecordSize() { return 10; }
+               public String getRecordName() { return ""; }
+       }
+
+       public void testGetRecordSize() {
+               EscherContainerRecord r = new EscherContainerRecord();
+               r.addChildRecord(new DummyEscherRecord());
+               assertEquals(18, r.getRecordSize());
+       }
+
+       /**
+        * We were having problems with reading too much data on an UnknownEscherRecord,
+        *  but hopefully we now read the correct size.
+        */
+       public void testBug44857() throws Exception {
+               File f = new File(ESCHER_DATA_PATH, "Container.dat");
+               assertTrue(f.exists());
+
+               FileInputStream finp = new FileInputStream(f);
+               byte[] data = IOUtils.toByteArray(finp);
+
+               // This used to fail with an OutOfMemory
+               EscherContainerRecord record = new EscherContainerRecord();
+               record.fillFields(data, 0, new DefaultEscherRecordFactory());
+       }
+
+       /**
+        * Ensure {@link EscherContainerRecord} doesn't spill its guts everywhere
+        */
+       public void testChildren() {
+               EscherContainerRecord ecr = new EscherContainerRecord();
+               List<EscherRecord> children0 = ecr.getChildRecords();
+               assertEquals(0, children0.size());
+
+               EscherRecord chA = new DummyEscherRecord();
+               EscherRecord chB = new DummyEscherRecord();
+               EscherRecord chC = new DummyEscherRecord();
+
+               ecr.addChildRecord(chA);
+               ecr.addChildRecord(chB);
+               children0.add(chC);
+
+               List<EscherRecord> children1 = ecr.getChildRecords();
+               assertTrue(children0 !=  children1);
+               assertEquals(2, children1.size());
+               assertEquals(chA, children1.get(0));
+               assertEquals(chB, children1.get(1));
+
+               assertEquals(1, children0.size()); // first copy unchanged
+
+               ecr.setChildRecords(children0);
+               ecr.addChildRecord(chA);
+               List<EscherRecord> children2 = ecr.getChildRecords();
+               assertEquals(2, children2.size());
+               assertEquals(chC, children2.get(0));
+               assertEquals(chA, children2.get(1));
        }
 }
index 70ddd47330b00d0e466dcee26c9a00fd34ff5c1a..523ba863d7ea25171b13e6307d9c75dceb41b76f 100644 (file)
@@ -21,8 +21,7 @@ import junit.framework.TestCase;
 import org.apache.poi.util.HexDump;
 import org.apache.poi.util.HexRead;
 
-public class TestEscherDgRecord extends TestCase
-{
+public final class TestEscherDgRecord extends TestCase {
     public void testSerialize() {
         EscherDgRecord r = createRecord();
 
@@ -53,13 +52,11 @@ public class TestEscherDgRecord extends TestCase
     }
 
     public void testToString() {
-        String nl = System.getProperty("line.separator");
-
-        String expected = "org.apache.poi.ddf.EscherDgRecord:" + nl +
-                "  RecordId: 0xF008" + nl +
-                "  Options: 0x0010" + nl +
-                "  NumShapes: 2" + nl +
-                "  LastMSOSPID: 1025" + nl;
+        String expected = "org.apache.poi.ddf.EscherDgRecord:" + '\n' +
+                "  RecordId: 0xF008" + '\n' +
+                "  Options: 0x0010" + '\n' +
+                "  NumShapes: 2" + '\n' +
+                "  LastMSOSPID: 1025" + '\n';
         assertEquals( expected, createRecord().toString() );
     }
 
index 89680669597237963c5b4bed28e44c6be417b581..b9628224dfb19d883e72875da0df796697d4132b 100644 (file)
@@ -21,8 +21,7 @@ import junit.framework.TestCase;
 import org.apache.poi.util.HexDump;
 import org.apache.poi.util.HexRead;
 
-public class TestEscherDggRecord extends TestCase
-{
+public final class TestEscherDggRecord extends TestCase {
     public void testSerialize() {
         EscherDggRecord r = createRecord();
 
@@ -64,17 +63,15 @@ public class TestEscherDggRecord extends TestCase
     }
 
     public void testToString() {
-        String nl = System.getProperty("line.separator");
-
-        String expected = "org.apache.poi.ddf.EscherDggRecord:" + nl +
-                "  RecordId: 0xF006" + nl +
-                "  Options: 0x0000" + nl +
-                "  ShapeIdMax: 1026" + nl +
-                "  NumIdClusters: 2" + nl +
-                "  NumShapesSaved: 2" + nl +
-                "  DrawingsSaved: 1" + nl +
-                "  DrawingGroupId1: 1" + nl +
-                "  NumShapeIdsUsed1: 2" + nl;
+        String expected = "org.apache.poi.ddf.EscherDggRecord:" + '\n' +
+                "  RecordId: 0xF006" + '\n' +
+                "  Options: 0x0000" + '\n' +
+                "  ShapeIdMax: 1026" + '\n' +
+                "  NumIdClusters: 2" + '\n' +
+                "  NumShapesSaved: 2" + '\n' +
+                "  DrawingsSaved: 1" + '\n' +
+                "  DrawingGroupId1: 1" + '\n' +
+                "  NumShapeIdsUsed1: 2" + '\n';
         assertEquals( expected, createRecord().toString() );
     }
 
index 9feca0abbcdc98b0e0bd0e0c2453429b8472a788..d49e9a0d0bbf43e427eca851ef5dba67c8a2262f 100644 (file)
@@ -21,8 +21,7 @@ import junit.framework.TestCase;
 import org.apache.poi.util.HexDump;
 import org.apache.poi.util.HexRead;
 
-public class TestEscherSpgrRecord extends TestCase
-{
+public final class TestEscherSpgrRecord extends TestCase {
     public void testSerialize() {
         EscherSpgrRecord r = createRecord();
 
@@ -59,15 +58,14 @@ public class TestEscherSpgrRecord extends TestCase
     }
 
     public void testToString() {
-        String nl = System.getProperty("line.separator");
 
-        String expected = "org.apache.poi.ddf.EscherSpgrRecord:" + nl +
-                "  RecordId: 0xF009" + nl +
-                "  Options: 0x0010" + nl +
-                "  RectX: 1" + nl +
-                "  RectY: 2" + nl +
-                "  RectWidth: 3" + nl +
-                "  RectHeight: 4" + nl;
+        String expected = "org.apache.poi.ddf.EscherSpgrRecord:" + '\n' +
+                "  RecordId: 0xF009" + '\n' +
+                "  Options: 0x0010" + '\n' +
+                "  RectX: 1" + '\n' +
+                "  RectY: 2" + '\n' +
+                "  RectWidth: 3" + '\n' +
+                "  RectHeight: 4" + '\n';
         assertEquals( expected, createRecord().toString() );
     }
 
index d9a9080713f790775d9263305a8edd2266260307..8a77bd59b4778017dc5ccf7f826c44df743b2188 100644 (file)
@@ -1,4 +1,3 @@
-
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
+
 package org.apache.poi.ddf;
 
 import junit.framework.TestCase;
 import org.apache.poi.util.HexDump;
 import org.apache.poi.util.HexRead;
 
-public class TestEscherSplitMenuColorsRecord extends TestCase
-{
+public final class TestEscherSplitMenuColorsRecord extends TestCase {
     public void testSerialize() {
         EscherSplitMenuColorsRecord r = createRecord();
 
@@ -60,15 +58,13 @@ public class TestEscherSplitMenuColorsRecord extends TestCase
     }
 
     public void testToString() {
-        String nl = System.getProperty("line.separator");
-
-        String expected = "org.apache.poi.ddf.EscherSplitMenuColorsRecord:" + nl +
-                "  RecordId: 0xF11E" + nl +
-                "  Options: 0x0040" + nl +
-                "  Color1: 0x00000402" + nl +
-                "  Color2: 0x00000002" + nl +
-                "  Color3: 0x00000002" + nl +
-                "  Color4: 0x00000001" + nl +
+        String expected = "org.apache.poi.ddf.EscherSplitMenuColorsRecord:" + '\n' +
+                "  RecordId: 0xF11E" + '\n' +
+                "  Options: 0x0040" + '\n' +
+                "  Color1: 0x00000402" + '\n' +
+                "  Color2: 0x00000002" + '\n' +
+                "  Color3: 0x00000002" + '\n' +
+                "  Color4: 0x00000001" + '\n' +
                 "";
         assertEquals( expected, createRecord().toString() );
     }
index d8c36e1a5cbe3d7322dcbf28efb9554b5c1dae07..2505dfc27207b07ae57ebf970c5309cf49c7778b 100644 (file)
@@ -1,4 +1,3 @@
-
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-        
+
 package org.apache.poi.ddf;
 
 import junit.framework.TestCase;
 import org.apache.poi.util.HexRead;
 import org.apache.poi.util.HexDump;
 
-public class TestUnknownEscherRecord extends TestCase
-{
+public final class TestUnknownEscherRecord extends TestCase {
     public void testFillFields() {
         String testData =
                 "0F 02 " + // options
@@ -108,12 +106,12 @@ public class TestUnknownEscherRecord extends TestCase
         byte[] data = new byte[8];
         r.serialize( 0, data, new NullEscherSerializationListener() );
 
-        String nl = System.getProperty("line.separator");
-        assertEquals( "org.apache.poi.ddf.UnknownEscherRecord:" + nl +
-                "  isContainer: false" + nl +
-                "  options: 0x1234" + nl +
-                "  recordId: 0xF112" + nl +
-                "  numchildren: 0" + nl
+        assertEquals( "org.apache.poi.ddf.UnknownEscherRecord:" + '\n' +
+                "  isContainer: false" + '\n' +
+                "  options: 0x1234" + '\n' +
+                "  recordId: 0xF112" + '\n' +
+                "  numchildren: 0" + '\n' +
+                ": 0"
                 , r.toString() );
     }
 }