BufferingLogDataCollectorProxy implements LogDataCollector, Stoppable { @Override public void stop() { stop = true; } BufferingLogDataCollectorProxy(LogDataCollector delegate, final long sleepTime, Configuration configuration); @Override synchronized void add(LogData... logDatas); @Override synchronized LogData[] getLogData(); @Override int getCount(); @Override void stop(); @Override int clear();  }
@Test public void testStop() throws InterruptedException { LogData data = new LogData(); AssertJUnit.assertEquals(0, delegate.getLogData().length); bufferingLogDataCollectorProxy.add(data); Thread.sleep(sleepTime * 2); AssertJUnit.assertEquals(1, delegate.getLogData().length); bufferingLogDataCollectorProxy.stop(); bufferingLogDataCollectorProxy.add(data); bufferingLogDataCollectorProxy.add(data); Thread.sleep(sleepTime * 3); AssertJUnit.assertEquals(1, delegate.getLogData().length); AssertJUnit.assertEquals(2, bufferingLogDataCollectorProxy.getLogData().length); }