public void flush() throws IOException {
    InterpreterResultMessageOutput out = getCurrentOutput();
    if (out != null) {
      out.flush();
    }
  }
@Test
  void testFlush() throws IOException {
    out.write("hello\nworld");
    assertEquals("hello\n", new String(out.getOutputAt(0).toByteArray()));
    assertEquals(1, numAppendEvent);
    assertEquals(1, numUpdateEvent);

    out.flush();
    assertEquals("hello\nworld", new String(out.getOutputAt(0).toByteArray()));
    assertEquals(2, numAppendEvent);
    assertEquals(1, numUpdateEvent);

    out.clear();
    out.write("%html div");
    assertEquals("", new String(out.getOutputAt(0).toByteArray()));
    assertEquals(InterpreterResult.Type.HTML, out.getOutputAt(0).getType());

    out.flush();
    assertEquals("div", new String(out.getOutputAt(0).toByteArray()));
  }