Home / Class/ CorrelationIdConverterTests Class — spring-boot Architecture

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/log4j2/CorrelationIdConverterTests.java lines 34–65

class CorrelationIdConverterTests {

	private CorrelationIdConverter converter = CorrelationIdConverter.newInstance(null);

	private final LogEvent event = new TestLogEvent();

	@Test
	void defaultPattern() {
		StringBuilder result = new StringBuilder();
		this.converter.format(this.event, result);
		assertThat(result).hasToString("[01234567890123456789012345678901-0123456789012345] ");
	}

	@Test
	void customPattern() {
		this.converter = CorrelationIdConverter.newInstance(new String[] { "traceId(0),spanId(0)" });
		StringBuilder result = new StringBuilder();
		this.converter.format(this.event, result);
		assertThat(result).hasToString("[01234567890123456789012345678901-0123456789012345] ");
	}

	static class TestLogEvent extends AbstractLogEvent {

		@Override
		public ReadOnlyStringMap getContextData() {
			return new JdkMapAdapterStringMap(
					Map.of("traceId", "01234567890123456789012345678901", "spanId", "0123456789012345"), true);
		}

	}

}

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free