for (int i = 0; i < length.length; i++) {
StringBuffer buff = new StringBuffer(length[i]);
for (int j = 0; j < length[i]; j++) {
buff.append("x");
}
HSSFRichTextString str = new HSSFRichTextString(buff.toString());
TextObjectRecord obj = new TextObjectRecord();
obj.setStr(str);
byte [] data = obj.serialize();
RecordInputStream is = new RecordInputStream(new ByteArrayInputStream(data));
is.nextRecord();
TextObjectRecord record = new TextObjectRecord(is);
str = record.getStr();
assertEquals(buff.length(), str.length());
assertEquals(buff.toString(), str.getString());
}
}