### Question:
LogChannelFileWriter { public synchronized void flush() { try { StringBuffer buffer = this.buffer.getBuffer(); logFileOutputStream.write( buffer.toString().getBytes() ); logFileOutputStream.flush(); } catch ( Exception e ) { exception = new HopException( "There was an error logging to file '" + logFile + "'", e ); } } LogChannelFileWriter( String logChannelId, FileObject logFile, boolean appending, int pollingInterval );  LogChannelFileWriter( String logChannelId, FileObject logFile, boolean appending ); void startLogging(); synchronized void flush(); void stopLogging(); HopException getException(); String getLogChannelId(); void setLogChannelId( String logChannelId ); FileObject getLogFile(); void setLogFile( FileObject logFile ); boolean isAppending(); void setAppending( boolean appending ); int getPollingInterval(); void setPollingInterval( int pollingInterval );  }### Answer:
@Test public void test() throws Exception { LogChannelFileWriter writer = new LogChannelFileWriter( id, fileObject, false ); LoggingRegistry.getInstance().getLogChannelFileWriterBuffer( id ).addEvent( new HopLoggingEvent( logMessage, System.currentTimeMillis(), LogLevel.BASIC ) ); writer.flush(); verify( outputStream ).write( captor.capture() ); String arguments = new String( captor.getValue() ); assertTrue( arguments.contains( logMessage ) ); }