1 2 17 18 19 20 package org.apache.poi.hssf.record; 21 22 23 import junit.framework.TestCase; 24 25 33 public class TestNumberFormatIndexRecord 34 extends TestCase 35 { 36 byte[] data = new byte[] { 37 0x05,0x00 38 }; 39 40 public TestNumberFormatIndexRecord(String name) 41 { 42 super(name); 43 } 44 45 public void testLoad() 46 throws Exception 47 { 48 49 NumberFormatIndexRecord record = new NumberFormatIndexRecord((short)0x104e, (short)data.length, data); 50 assertEquals( 5, record.getFormatIndex()); 51 52 53 assertEquals( 6, record.getRecordSize() ); 54 55 record.validateSid((short)0x104e); 56 } 57 58 public void testStore() 59 { 60 NumberFormatIndexRecord record = new NumberFormatIndexRecord(); 61 record.setFormatIndex( (short)5 ); 62 63 64 byte [] recordBytes = record.serialize(); 65 assertEquals(recordBytes.length - 4, data.length); 66 for (int i = 0; i < data.length; i++) 67 assertEquals("At offset " + i, data[i], recordBytes[i+4]); 68 } 69 } 70 | Popular Tags |