@Test
public void testFlush() throws IOException {

  final StringWriter writer = new StringWriter();
  final WriterOutputStream out = new WriterOutputStream(writer, "us-ascii", 1024);
  out.write("abc".getBytes(StandardCharsets.US_ASCII));
  assertEquals(0, writer.getBuffer().length());
  out.flush();
  assertEquals("abc", writer.toString());
  out.close();
}