}
public void testCopy_stringToOutputStream() throws Exception {
String str = new String(inData, "US-ASCII");
ByteArrayOutputStream baout = new ByteArrayOutputStream();
OutputStream out = new YellOnFlushAndCloseOutputStream(baout, false, true);
CopyUtils.copy(str, out);
//Note: this method *does* flush. It is equivalent to:
// OutputStreamWriter _out = new OutputStreamWriter(fout);
// IOUtils.copy( str, _out, 4096 ); // copy( Reader, Writer, int );
// _out.flush();
// out = fout;
// note: we don't flush here; this IOUtils method does it for us
assertEquals("Sizes differ", inData.length, baout.size());
assertTrue("Content differs", Arrays.equals(inData, baout.toByteArray()));
}