### Question:
AsyncOpsLogger implements OpsLogger<T> { @Override public void close() throws Exception { if (closeable) { try { transferQueue.put(Optional.empty()); processingThread.get(); } finally { destination.close(); } } } AsyncOpsLogger(Clock clock, DiagnosticContextSupplier diagnosticContextSupplier, Destination<T> destination, Consumer<Throwable> errorHandler, LinkedTransferQueue<Optional<LogicalLogRecord<T>>> transferQueue, AsyncExecutor executor); private  AsyncOpsLogger(Clock clock, DiagnosticContextSupplier diagnosticContextSupplier, Destination<T> destination, Consumer<Throwable> errorHandler, LinkedTransferQueue<Optional<LogicalLogRecord<T>>> transferQueue, Future<?> processingThread, boolean closeable); @Override void log(T message, Object... details); @Override void logThrowable(T message, Throwable cause, Object... details); @Override AsyncOpsLogger<T> with(DiagnosticContextSupplier override); @Override void close(); Clock getClock(); Destination<T> getDestination(); DiagnosticContextSupplier getDiagnosticContextSupplier(); Consumer<Throwable> getErrorHandler(); LinkedTransferQueue<Optional<LogicalLogRecord<T>>> getTransferQueue();  }### Answer:
@Test public void close_shouldSendAStopSignalToTheProcessingThreadWaitForItToFinishAndCloseTheDestination() throws Exception { logger.close(); InOrder order = inOrder(transferQueue, processingThread, destination); order.verify(transferQueue).put(argThat(isEmpty())); order.verify(processingThread).get(); order.verify(destination).close(); }
@Test public void close_shouldCloseTheDestination_whenAnExceptionIsThrownWaitingForTheProcessingThreadToFinish() throws Exception { when(processingThread.get()).thenThrow(new InterruptedException()); try { logger.close(); } catch (InterruptedException ignore) {} verify(destination).close(); }