### Question:
BasicOpsLogger implements OpsLogger<T> { @Override public void log(T message, Object... details) { try { LogicalLogRecord<T> record = constructLogRecord(message, Optional.empty(), details); publish(record); } catch (Throwable t) { errorHandler.accept(t); } } BasicOpsLogger(Clock clock, DiagnosticContextSupplier diagnosticContextSupplier, Destination<T> destination, Lock lock, Consumer<Throwable> errorHandler); private  BasicOpsLogger(Clock clock, DiagnosticContextSupplier diagnosticContextSupplier, Destination<T> destination, Lock lock, Consumer<Throwable> errorHandler, boolean closeable); @Override void close(); @Override void log(T message, Object... details); @Override void logThrowable(T message, Throwable cause, Object... details); @Override BasicOpsLogger<T> with(DiagnosticContextSupplier override); Clock getClock(); Destination<T> getDestination(); DiagnosticContextSupplier getDiagnosticContextSupplier(); Lock getLock(); Consumer<Throwable> getErrorHandler();  }### Answer:
@Test public void log_shouldExposeAnExceptionToTheHandler_givenAProblemCreatingTheLogRecord() throws Exception { logger.log(null); verify(exceptionConsumer).accept(Mockito.isA(NullPointerException.class)); }
@Test public void log_shouldNotAcquireALockOrInteractWithTheDestination_givenAProblemCreatingTheLogRecord() throws Exception { logger.log(null); verifyZeroInteractions(lock, destination); }
@Test public void log_shouldExposeAnExceptionToTheHandler_givenAProblemObtainingCorrelationIds() throws Exception { Error expectedThrowable = new Error(); when(diagnosticContextSupplier.getMessageContext()).thenThrow(expectedThrowable); logger.log(TestMessages.Foo); verify(exceptionConsumer).accept(Mockito.same(expectedThrowable)); }
@Test public void log_shouldNotAcquireALockOrInteractWithTheDestination_givenAProblemObtainingCorrelationIds() throws Exception { when(diagnosticContextSupplier.getMessageContext()).thenThrow(new RuntimeException()); logger.log(TestMessages.Foo); verifyZeroInteractions(lock, destination); }