Hello All,
One test case tests.api.java.io.BufferedOutputStreamTest.test_write$BII
fails on RI (passes on Harmony) because the default buf size between RI
and Harmony are different. The default buf size is not specified in the
Java Specification. If we can detect what the default buf size of RI is
by some test cases, shall we use the same default buf size as RI? Any
comments? Thanks a lot.
public void test_write$BII() {
// Test for method void java.io.BufferedOutputStream.write(byte
[], int,
// int)
try {
os = new java.io.BufferedOutputStream(
baos = new java.io.ByteArrayOutputStream());
os.write(fileString.getBytes(), 0, 500);
bais = new java.io.ByteArrayInputStream(baos.toByteArray());
assertEquals("Bytes written, not buffered", 0,
bais.available());
os.flush();
bais = new java.io.ByteArrayInputStream(baos.toByteArray());
assertEquals("Bytes not written after flush", 500,
bais.available());
os.write(fileString.getBytes(), 500, 513);
bais = new java.io.ByteArrayInputStream(baos.toByteArray());
assertTrue("Bytes not written when buffer full",
bais.available() >= 1000);
byte[] wbytes = new byte[1013];
bais.read(wbytes, 0, 1013);
assertTrue("Incorrect bytes written",
fileString.substring(0, 1013)
.equals(new String(wbytes, 0, wbytes.length)));
} catch (java.io.IOException e) {
fail("Flush test failed");
}
}
--
Richard Liang
China Software Development Lab, IBM
---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]