TestNoteRecordpublic class TestNoteRecord extends TestCase Tests the serialization and deserialization of the NoteRecord
class works correctly. Test data taken directly from a real
Excel file. |
Fields Summary |
---|
private byte[] | data |
Constructors Summary |
---|
public TestNoteRecord(String name)
super(name);
|
Methods Summary |
---|
public void | testRead()
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 void | testWrite()
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));
|
|