1 2 17 18 19 20 package org.apache.poi.hssf.record; 21 22 23 import junit.framework.TestCase; 24 25 33 public class TestObjectLinkRecord 34 extends TestCase 35 { 36 byte[] data = new byte[] { 37 (byte)0x03,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00 38 }; 39 40 public TestObjectLinkRecord(String name) 41 { 42 super(name); 43 } 44 45 public void testLoad() 46 throws Exception 47 { 48 ObjectLinkRecord record = new ObjectLinkRecord((short)0x1027, (short)data.length, data); 49 50 51 assertEquals( (short)3, record.getAnchorId()); 52 53 assertEquals( (short)0x00, record.getLink1()); 54 55 assertEquals( (short)0x00, record.getLink2()); 56 57 58 assertEquals( 10, record.getRecordSize() ); 59 60 record.validateSid((short)0x1027); 61 } 62 63 public void testStore() 64 { 65 ObjectLinkRecord record = new ObjectLinkRecord(); 66 67 68 69 record.setAnchorId( (short)3 ); 70 71 record.setLink1( (short)0x00 ); 72 73 record.setLink2( (short)0x00 ); 74 75 76 byte [] recordBytes = record.serialize(); 77 assertEquals(recordBytes.length - 4, data.length); 78 for (int i = 0; i < data.length; i++) 79 assertEquals("At offset " + i, data[i], recordBytes[i+4]); 80 } 81 } 82 | Popular Tags |