### Question:
BufferedEchoMessageEncoder extends EchoEncoder<ILoggingEvent> { @Override public void doEncode(ILoggingEvent event) throws IOException { outputStream.write(event.getMessage().getBytes()); outputStream.write(LINE_SEPARATOR_BYTES); }  @Override void init(OutputStream os); @Override void doEncode(ILoggingEvent event); @Override void close(); int getBufferSize(); void setBufferSize(int bufferSize);  }### Answer:
@Test public void testDoEncode() throws Exception { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); m_encoder.init(baos); m_encoder.start(); when(m_event.getMessage()).thenReturn("hello"); m_encoder.doEncode(m_event); when(m_event.getMessage()).thenReturn("world"); m_encoder.doEncode(m_event); m_encoder.close(); assertEquals("hello" + CoreConstants.LINE_SEPARATOR + "world" + CoreConstants.LINE_SEPARATOR, baos.toString()); }