FileDocCategorySizeDatePackage
TestNoteRecord.javaAPI DocApache Poi 3.0.12878Mon Jan 01 18:59:10 GMT 2007org.apache.poi.hssf.record

TestNoteRecord

public class TestNoteRecord extends TestCase
Tests the serialization and deserialization of the NoteRecord class works correctly. Test data taken directly from a real Excel file.
author
Yegor Kozlov

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


      
    
        super(name);
    
Methods Summary
public voidtestRead()


        NoteRecord record = new NoteRecord(new TestcaseRecordInputStream(NoteRecord.sid, (short)data.length, data));

        assertEquals(NoteRecord.sid, record.getSid());
        record.validateSid(NoteRecord.sid);
        assertEquals(6, record.getRow());
        assertEquals(1, record.getColumn());
        assertEquals(NoteRecord.NOTE_VISIBLE, record.getFlags());
        assertEquals(1026, record.getShapeId());
        assertEquals("Apache Software Foundation", record.getAuthor());

    
public voidtestWrite()

        NoteRecord record = new NoteRecord();
        assertEquals(NoteRecord.sid, record.getSid());
        record.validateSid(NoteRecord.sid);
        
        record.setRow((short)6);
        record.setColumn((short)1);
        record.setFlags(NoteRecord.NOTE_VISIBLE);
        record.setShapeId((short)1026);
        record.setAuthor("Apache Software Foundation");

        byte [] ser = record.serialize();
        assertEquals(ser.length - 4, data.length);

        byte[] recdata = new byte[ser.length - 4];
        System.arraycopy(ser, 4, recdata, 0, recdata.length);
        assertTrue(Arrays.equals(data, recdata));