// we've closed the stream - and should have a fake
// writer. Ensure writing to it doesn't impact the result;
writer.print("Some junk");
StringWriter buf = new StringWriter();
w1.flushToWriter(buf, "ISO-8859-1");
assertTrue(!buf.toString().contains("Some junk"));
// ensure that the content that was written to the stream is
// present
assertTrue("1".equals(buf.toString()));