TestTextBytesAtompublic class TestTextBytesAtom extends TestCase Tests that TextBytesAtom works properly |
Fields Summary |
---|
private byte[] | data | private String | data_text | private byte[] | alt_data | private String | alt_text |
Methods Summary |
---|
public void | testChangeText()
TextBytesAtom tba = new TextBytesAtom(data,0,data.length);
tba.setText(alt_text.getBytes("ISO-8859-1"));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
tba.writeOut(baos);
byte[] b = baos.toByteArray();
// Compare the header and the text
assertEquals(alt_data.length, b.length);
for(int i=0; i<alt_data.length; i++) {
assertEquals(alt_data[i],b[i]);
}
| public void | testRecordType()
TextBytesAtom tba = new TextBytesAtom(data,0,data.length);
assertEquals(4008l, tba.getRecordType());
| public void | testTextA()
TextBytesAtom tba = new TextBytesAtom(data,0,data.length);
assertEquals(data_text, tba.getText());
| public void | testTextB()
TextBytesAtom tba = new TextBytesAtom(alt_data,0,alt_data.length);
assertEquals(alt_text, tba.getText());
| public void | testWrite()
TextBytesAtom tba = new TextBytesAtom(data,0,data.length);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
tba.writeOut(baos);
byte[] b = baos.toByteArray();
assertEquals(data.length, b.length);
for(int i=0; i<data.length; i++) {
assertEquals(data[i],b[i]);
}
|
|