assertTrue(stream.closed);
}
public void testWrite() throws IOException {
final ByteArrayOutputStream stream = new ByteArrayOutputStream();
final OutputStream out = new UnclosableOutputStream(stream);
out.write('a');
assertEquals("a", new String(stream.toByteArray()));
out.write(new byte[] { 'b', 'c' });
assertEquals("abc", new String(stream.toByteArray()));
out.write(new byte[] { 'd', 'e', 'f', 'g' }, 0, 2);
assertEquals("abcde", new String(stream.toByteArray()));
}