### Question:
LoggingBuffer { public void removeBufferLinesBefore( long minTimeBoundary ) { Set<BufferLine> linesToRemove = new HashSet<>(); lock.writeLock().lock(); try { for ( BufferLine bufferLine : buffer ) { if ( bufferLine.getEvent().timeStamp < minTimeBoundary ) { linesToRemove.add( bufferLine ); } else { break; } } buffer.removeAll( linesToRemove ); } finally { lock.writeLock().unlock(); } } LoggingBuffer( int bufferSize ); int getLastBufferLineNr(); List<HopLoggingEvent> getLogBufferFromTo( List<String> channelId, boolean includeGeneral, int from,
                                                   int to ); List<HopLoggingEvent> getLogBufferFromTo( String parentLogChannelId, boolean includeGeneral, int from,
                                                   int to ); StringBuffer getBuffer( String parentLogChannelId, boolean includeGeneral, int startLineNr, int endLineNr ); StringBuffer getBuffer( String parentLogChannelId, boolean includeGeneral ); StringBuffer getBuffer( String parentLogChannelId, boolean includeGeneral, int startLineNr ); StringBuffer getBuffer(); void close(); void doAppend( HopLoggingEvent event ); void setName( String name ); String getName(); void setLayout( HopLogLayout layout ); HopLogLayout getLayout(); boolean requiresLayout(); void clear(); int getMaxNrLines(); void setMaxNrLines( int maxNrLines ); int getNrLines(); void removeChannelFromBuffer( String id ); int size(); void removeGeneralMessages(); @Deprecated @VisibleForTesting Iterator<BufferLine> getBufferIterator(); @Deprecated String dump(); @Deprecated void removeBufferLines( List<BufferLine> linesToRemove ); @Deprecated List<BufferLine> getBufferLinesBefore( long minTimeBoundary ); void removeBufferLinesBefore( long minTimeBoundary ); void addLogggingEvent( HopLoggingEvent loggingEvent ); void addLoggingEventListener( IHopLoggingEventListener listener ); void removeLoggingEventListener( IHopLoggingEventListener listener );  }### Answer:
@Test public void testRemoveBufferLinesBefore() { LoggingBuffer loggingBuffer = new LoggingBuffer( 100 ); for ( int i = 0; i < 40; i++ ) { HopLoggingEvent event = new HopLoggingEvent(); event.setMessage( new LogMessage( "test", LogLevel.BASIC ) ); event.setTimeStamp( i ); loggingBuffer.addLogggingEvent( event ); } loggingBuffer.removeBufferLinesBefore( 20 ); Assert.assertEquals( 20, loggingBuffer.size() ); }