1 2 17 18 19 20 package org.apache.poi.hssf.record; 21 22 23 import junit.framework.TestCase; 24 25 31 public class TestSupBookRecord 32 extends TestCase 33 { 34 37 byte[] data = new byte[] { 38 (byte)0x04,(byte)0x00,(byte)0x01,(byte)0x04 39 }; 40 41 public TestSupBookRecord(String name) 42 { 43 super(name); 44 } 45 46 49 public void testLoad() 50 throws Exception 51 { 52 53 SupBookRecord record = new SupBookRecord((short)0x01AE, (short)data.length, data); 54 assertEquals( 0x401, record.getFlag()); assertEquals( 0x4, record.getNumberOfSheets() ); 57 assertEquals( 8, record.getRecordSize() ); 59 record.validateSid((short)0x01AE); 60 } 61 62 63 67 public void testStore() 68 { 69 SupBookRecord record = new SupBookRecord(); 70 record.setFlag( (short) 0x401 ); 71 record.setNumberOfSheets( (short)0x4 ); 72 73 74 75 byte [] recordBytes = record.serialize(); 76 assertEquals(recordBytes.length - 4, data.length); 77 for (int i = 0; i < data.length; i++) 78 assertEquals("At offset " + i, data[i], recordBytes[i+4]); 79 } 80 81 public static void main(String [] args) { 82 System.out 83 .println("Testing org.apache.poi.hssf.record.SupBookRecord"); 84 junit.textui.TestRunner.run(TestSupBookRecord.class); 85 } 86 87 88 } 89 | Popular Tags |