1 2 17 18 19 20 package org.apache.poi.hssf.record; 21 22 23 import junit.framework.TestCase; 24 25 32 public class TestStringRecord 33 extends TestCase 34 { 35 byte[] data = new byte[] { 36 (byte)0x0B,(byte)0x00, (byte)0x00, (byte)0x46,(byte)0x61,(byte)0x68,(byte)0x72,(byte)0x7A,(byte)0x65,(byte)0x75,(byte)0x67,(byte)0x74,(byte)0x79,(byte)0x70 40 }; 41 42 public TestStringRecord(String name) 43 { 44 super(name); 45 } 46 47 public void testLoad() 48 throws Exception 49 { 50 51 StringRecord record = new StringRecord((short)0x207, (short)data.length, data); 52 assertEquals( "Fahrzeugtyp", record.getString()); 53 54 assertEquals( 18, record.getRecordSize() ); 55 56 record.validateSid((short)0x207); 57 } 58 59 public void testStore() 60 { 61 StringRecord record = new StringRecord(); 62 record.setString("Fahrzeugtyp"); 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 |