import java.util.Arrays;
import java.util.List;
-import org.apache.poi.util.HexRead;
-
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
+import org.apache.poi.util.HexRead;
+
/**
* Tests the serialization and deserialization of the ObjRecord class works correctly.
* Test data taken directly from a real Excel file.
// it's not bug 38607 attachment 17639
);
+ /**
+ * Hex dump from
+ * offset 0x2072 in att 22076 of bug 45133
+ */
private static final byte[] recdataNeedingPadding = HexRead.readFromString(""
+ + "5D 00 20 00"
+ "15 00 12 00 00 00 01 00 11 60 00 00 00 00 38 6F CC 03 00 00 00 00 06 00 02 00 00 00 00 00 00 00"
);
assertEquals(26, record.getRecordSize() - 4);
- List subrecords = record.getSubRecords();
+ List<SubRecord> subrecords = record.getSubRecords();
assertEquals(2, subrecords.size() );
assertTrue(subrecords.get(0) instanceof CommonObjectDataSubRecord);
assertTrue(subrecords.get(1) instanceof EndSubRecord );
System.arraycopy(recordBytes, 4, bytes, 0, bytes.length);
record = new ObjRecord(TestcaseRecordInputStream.create(ObjRecord.sid, bytes));
- List subrecords = record.getSubRecords();
+ List<SubRecord> subrecords = record.getSubRecords();
assertEquals( 2, subrecords.size() );
assertTrue( subrecords.get(0) instanceof CommonObjectDataSubRecord);
assertTrue( subrecords.get(1) instanceof EndSubRecord );
}
public void testReadWriteWithPadding_bug45133() {
- ObjRecord record = new ObjRecord(TestcaseRecordInputStream.create(ObjRecord.sid, recdataNeedingPadding));
+ ObjRecord record = new ObjRecord(TestcaseRecordInputStream.create(recdataNeedingPadding));
if (record.getRecordSize() == 34) {
throw new AssertionFailedError("Identified bug 45133");
assertEquals(36, record.getRecordSize());
- List subrecords = record.getSubRecords();
+ List<SubRecord> subrecords = record.getSubRecords();
assertEquals(3, subrecords.size() );
assertEquals(CommonObjectDataSubRecord.class, subrecords.get(0).getClass());
assertEquals(GroupMarkerSubRecord.class, subrecords.get(1).getClass());