package org.apache.poi.hssf.record;
import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.util.List;
-import junit.framework.AssertionFailedError;
-import junit.framework.TestCase;
-
import org.apache.poi.util.HexRead;
+import org.junit.Test;
/**
* Tests the serialization and deserialization of the ObjRecord class works correctly.
* Test data taken directly from a real Excel file.
- *
- * @author Yegor Kozlov
*/
-public final class TestObjRecord extends TestCase {
+public final class TestObjRecord {
/**
* OBJ record data containing two sub-records.
* The data taken directly from a real Excel file.
+ "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"
);
+ @Test
public void testLoad() {
ObjRecord record = new ObjRecord(TestcaseRecordInputStream.create(ObjRecord.sid, recdata));
}
+ @Test
public void testStore() {
ObjRecord record = new ObjRecord(TestcaseRecordInputStream.create(ObjRecord.sid, recdata));
assertArrayEquals(recdata, subData);
}
+ @Test
public void testConstruct() {
ObjRecord record = new ObjRecord();
CommonObjectDataSubRecord ftCmo = new CommonObjectDataSubRecord();
assertTrue( subrecords.get(1) instanceof EndSubRecord );
}
+ @Test
public void testReadWriteWithPadding_bug45133() {
ObjRecord record = new ObjRecord(TestcaseRecordInputStream.create(recdataNeedingPadding));
if (record.getRecordSize() == 34) {
- throw new AssertionFailedError("Identified bug 45133");
+ fail("Identified bug 45133");
}
assertEquals(36, record.getRecordSize());
* Check that ObjRecord tolerates and preserves padding to a 4-byte boundary
* (normally padding is to a 2-byte boundary).
*/
+ @Test
public void test4BytePadding() {
// actual data from file saved by Excel 2007
byte[] data = HexRead.readFromString(""