TestTextCharsAtompublic class TestTextCharsAtom extends TestCase Tests that TextCharsAtom works properly |
Fields Summary |
---|
private byte[] | data | private String | data_text | private byte[] | alt_data | private String | alt_text |
Methods Summary |
---|
public void | testChangeText()
TextCharsAtom tca = new TextCharsAtom(data,0,data.length);
tca.setText(alt_text);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
tca.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 | testCreateNew()
TextCharsAtom tca = new TextCharsAtom();
assertEquals(0, tca.getText().length());
tca.setText(data_text);
assertEquals(data_text, tca.getText());
// Check it's now like data
ByteArrayOutputStream baos = new ByteArrayOutputStream();
tca.writeOut(baos);
byte[] b = baos.toByteArray();
assertEquals(data.length, b.length);
for(int i=0; i<data.length; i++) {
assertEquals(data[i],b[i]);
}
| public void | testRecordType()
TextCharsAtom tca = new TextCharsAtom(data,0,data.length);
assertEquals(4000l, tca.getRecordType());
| public void | testTextA()
TextCharsAtom tca = new TextCharsAtom(data,0,data.length);
assertEquals(data_text, tca.getText());
| public void | testTextB()
TextCharsAtom tca = new TextCharsAtom(alt_data,0,alt_data.length);
assertEquals(alt_text, tca.getText());
| public void | testWrite()
TextCharsAtom tca = new TextCharsAtom(data,0,data.length);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
tca.writeOut(baos);
byte[] b = baos.toByteArray();
assertEquals(data.length, b.length);
for(int i=0; i<data.length; i++) {
assertEquals(data[i],b[i]);
}
|
|