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

TestAxisRecord

public class TestAxisRecord extends TestCase
Tests the serialization and deserialization of the AxisRecord class works correctly. Test data taken directly from a real Excel file.
author
Glen Stampoultzis (glens at apache.org)

Fields Summary
byte[]
data
Constructors Summary
public TestAxisRecord(String name)


      
    
        super(name);
    
Methods Summary
public voidtestLoad()


        AxisRecord record = new AxisRecord(new TestcaseRecordInputStream((short)0x101d, (short)data.length, data));
        assertEquals( AxisRecord.AXIS_TYPE_CATEGORY_OR_X_AXIS, record.getAxisType());
        assertEquals( 0, record.getReserved1());
        assertEquals( 0, record.getReserved2());
        assertEquals( 0, record.getReserved3());
        assertEquals( 0, record.getReserved4());


        assertEquals( 4 + 18, record.getRecordSize() );

        record.validateSid((short)0x101d);
    
public voidtestStore()

        AxisRecord record = new AxisRecord();
        record.setAxisType( AxisRecord.AXIS_TYPE_CATEGORY_OR_X_AXIS );
        record.setReserved1( 0 );
        record.setReserved2( 0 );
        record.setReserved3( 0 );
        record.setReserved4( 0 );


        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]);