public void testConstructor() throws IOException {
ByteArrayInputStream input = new ByteArrayInputStream(_testdata);
int index = 0;
int size = 0;
while (true)
{
byte[] data = new byte[ Math.min(_testdata.length - index, 512) ];
System.arraycopy(_testdata, index, data, 0, data.length);
DocumentBlock block = new DocumentBlock(input);
verifyOutput(block, data);
size += block.size();
if (block.partiallyRead())
{
break;
}
index += 512;
}
assertEquals(_testdata.length, size);
}
Test the writing DocumentBlock constructor. |