FileDocCategorySizeDatePackage
TestSupBookRecord.javaAPI DocApache Poi 3.0.12724Mon Jan 01 12:39:46 GMT 2007org.apache.poi.hssf.record

TestSupBookRecord

public class TestSupBookRecord extends TestCase
Tests the serialization and deserialization of the SupBook record class works correctly.
author
Andrew C. Oliver (acoliver at apache dot org)

Fields Summary
byte[]
data
This contains a fake data section of a SubBookRecord
Constructors Summary
public TestSupBookRecord(String name)


      
    
        super(name);
    
Methods Summary
public static voidmain(java.lang.String[] args)

        System.out
        .println("Testing org.apache.poi.hssf.record.SupBookRecord");
        junit.textui.TestRunner.run(TestSupBookRecord.class);
    
public voidtestLoad()
tests that we can load the record


        SupBookRecord record = new SupBookRecord(new TestcaseRecordInputStream((short)0x01AE, (short)data.length, data));      
        assertEquals( 0x401, record.getFlag());             //expected flag
        assertEquals( 0x4, record.getNumberOfSheets() );    //expected # of sheets

        assertEquals( 8, record.getRecordSize() );  //sid+size+data

        record.validateSid((short)0x01AE);
    
public voidtestStore()
Tests that we can store the record

        SupBookRecord record = new SupBookRecord();
        record.setFlag( (short) 0x401 );
        record.setNumberOfSheets( (short)0x4 );
        


        byte [] recordBytes = record.serialize();
        assertEquals(recordBytes.length - 4, data.length);
        for (int i = 0; i < data.length; i++)
            assertEquals("At offset " + i, data[i], recordBytes[i+4]);