@Test public void configureCorrelationIdSupplier_shouldReturnTheProvidedSupplier_whenOneIsProvided() throws Exception { DiagnosticContextSupplier expectedSupplier = HashMap::new; InfrastructureFactory factory = new InfrastructureFactory( SAMPLE_LOGFILE_PATH, SAMPLE_LOGGER_OUTPUT, SAMPLE_STORE_STACK_TRACES_IN_FILESYSTEM, SAMPLE_STACK_TRACE_STORAGE_PATH, Optional.of(expectedSupplier), SAMPLE_ERROR_HANDLER); DiagnosticContextSupplier actualSupplier = factory.configureContextSupplier(); assertSame(expectedSupplier, actualSupplier); }
public DiagnosticContextSupplier configureContextSupplier() { return correlationIdSupplier.orElse(EMPTY_CONTEXT_SUPPLIER); }
InfrastructureFactory { public DiagnosticContextSupplier configureContextSupplier() { return correlationIdSupplier.orElse(EMPTY_CONTEXT_SUPPLIER); } }
InfrastructureFactory { public DiagnosticContextSupplier configureContextSupplier() { return correlationIdSupplier.orElse(EMPTY_CONTEXT_SUPPLIER); } InfrastructureFactory(Optional<Path> logfilePath, Optional<PrintStream> loggerOutput, Optional<Boolean> storeStackTracesInFilesystem, Optional<Path> stackTraceStoragePath, Optional<DiagnosticContextSupplier> correlationIdSupplier, Optional<Consumer<Throwable>> errorHandler); }
InfrastructureFactory { public DiagnosticContextSupplier configureContextSupplier() { return correlationIdSupplier.orElse(EMPTY_CONTEXT_SUPPLIER); } InfrastructureFactory(Optional<Path> logfilePath, Optional<PrintStream> loggerOutput, Optional<Boolean> storeStackTracesInFilesystem, Optional<Path> stackTraceStoragePath, Optional<DiagnosticContextSupplier> correlationIdSupplier, Optional<Consumer<Throwable>> errorHandler); Destination<T> configureDestination(); Consumer<Throwable> configureErrorHandler(); DiagnosticContextSupplier configureContextSupplier(); Optional<Path> getLogfilePath(); Optional<PrintStream> getLoggerOutput(); Optional<Boolean> getStoreStackTracesInFilesystem(); Optional<Path> getStackTraceStoragePath(); Optional<DiagnosticContextSupplier> getContextSupplier(); Optional<Consumer<Throwable>> getErrorHandler(); }
InfrastructureFactory { public DiagnosticContextSupplier configureContextSupplier() { return correlationIdSupplier.orElse(EMPTY_CONTEXT_SUPPLIER); } InfrastructureFactory(Optional<Path> logfilePath, Optional<PrintStream> loggerOutput, Optional<Boolean> storeStackTracesInFilesystem, Optional<Path> stackTraceStoragePath, Optional<DiagnosticContextSupplier> correlationIdSupplier, Optional<Consumer<Throwable>> errorHandler); Destination<T> configureDestination(); Consumer<Throwable> configureErrorHandler(); DiagnosticContextSupplier configureContextSupplier(); Optional<Path> getLogfilePath(); Optional<PrintStream> getLoggerOutput(); Optional<Boolean> getStoreStackTracesInFilesystem(); Optional<Path> getStackTraceStoragePath(); Optional<DiagnosticContextSupplier> getContextSupplier(); Optional<Consumer<Throwable>> getErrorHandler(); static final Consumer<Throwable> DEFAULT_ERROR_HANDLER; static final DiagnosticContextSupplier EMPTY_CONTEXT_SUPPLIER; }