### Question:
EventSendBuffer implements EventReceiver { @Override public void close() { long delayPerWait = 2000; try { sendingTask.unsetInterval(); savingTask.unsetInterval(); savingTask.waitUntilFinished(delayPerWait); savingTask.start(); savingTask.waitUntilFinished(delayPerWait); sendingTask.waitUntilFinished(delayPerWait); } catch (TimeoutException ex) { log.log(Level.WARNING, "Time out when closing EventSendBuffer", ex); } catch (InterruptedException ex) { log.log(Level.WARNING, "Closing EventSendBuffer interrupted", ex); } } EventSendBuffer(EventStore store, Settings settings, ArrayDeque<LoggableEvent> sendQueue,
            SingletonTask sendingTask, SingletonTask savingTask, AtomicInteger eventsToRemoveAfterSend); void setSendingInterval(long interval); void setSavingInterval(long interval); void waitUntilCurrentSendingFinished(long timeout); @Override void receiveEvent(LoggableEvent event); @Override void close(); static final long DEFAULT_SEND_INTERVAL; static final long DEFAULT_SAVE_INTERVAL; static final int DEFAULT_MAX_EVENTS; static final int DEFAULT_AUTOSEND_THREHSOLD; static final int DEFAULT_AUTOSEND_COOLDOWN; }### Answer:
@Test public void closeTest() { buffer.setSavingInterval(1); buffer.close(); verify(savingTask, times(1)).run(); }