CorrelationIdConverterTests Class — spring-boot Architecture
Architecture documentation for the CorrelationIdConverterTests class in CorrelationIdConverterTests.java from the spring-boot codebase.
Entity Profile
Source Code
core/spring-boot/src/test/java/org/springframework/boot/logging/logback/CorrelationIdConverterTests.java lines 33–67
class CorrelationIdConverterTests {
private final CorrelationIdConverter converter;
private final LoggingEvent event = new LoggingEvent();
CorrelationIdConverterTests() {
this.converter = new CorrelationIdConverter();
this.converter.setContext(new LoggerContext());
}
@Test
void defaultPattern() {
addMdcProperties(this.event);
this.converter.start();
String converted = this.converter.convert(this.event);
this.converter.stop();
assertThat(converted).isEqualTo("[01234567890123456789012345678901-0123456789012345] ");
}
@Test
void customPattern() {
this.converter.setOptionList(List.of("traceId(0)", "spanId(0)"));
addMdcProperties(this.event);
this.converter.start();
String converted = this.converter.convert(this.event);
this.converter.stop();
assertThat(converted).isEqualTo("[01234567890123456789012345678901-0123456789012345] ");
}
private void addMdcProperties(LoggingEvent event) {
event.setMDCPropertyMap(Map.of("traceId", "01234567890123456789012345678901", "spanId", "0123456789012345"));
}
}
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free