### Question:
BasicOpsLoggerFactory { public <T extends Enum<T> & LogMessage> BasicOpsLogger<T> build(InfrastructureFactory infrastructureFactory) { DiagnosticContextSupplier correlationIdSupplier = infrastructureFactory.configureContextSupplier(); Consumer<Throwable> errorHandler = infrastructureFactory.configureErrorHandler(); Destination<T> destination = infrastructureFactory.configureDestination(); return new BasicOpsLogger<>(Clock.systemUTC(), correlationIdSupplier, destination, new ReentrantLock(), errorHandler); }  BasicOpsLogger<T> build(InfrastructureFactory infrastructureFactory);  }### Answer:
@Test public void build_shouldConstructACorrectlyConfiguredBasicOpsLogger() throws Exception { BasicOpsLogger<TestMessages> result = factory.build(infrastructure); assertEquals(Clock.systemUTC(), result.getClock()); assertSame(expectedDiagnosticContextSupplier, result.getDiagnosticContextSupplier()); assertSame(expectedDestination, result.getDestination()); assertNotNull(result.getLock()); assertThat(result.getLock(), instanceOf(ReentrantLock.class)); assertSame(expectedErrorHandler, result.getErrorHandler()); }
@Test public void build_shouldUseADifferentLockForEachConstructedOpsLogger() throws Exception { BasicOpsLogger<TestMessages> firstResult = factory.build(infrastructure); BasicOpsLogger<TestMessages> secondResult = factory.build(infrastructure); assertNotNull(firstResult.getLock()); assertNotNull(secondResult.getLock()); assertNotEquals(firstResult.getLock(), secondResult.getLock()); }