Home / Class/ ConditionEvaluationReportLoggingProcessorTests Class — spring-boot Architecture

ConditionEvaluationReportLoggingProcessorTests Class — spring-boot Architecture

Architecture documentation for the ConditionEvaluationReportLoggingProcessorTests class in ConditionEvaluationReportLoggingProcessorTests.java from the spring-boot codebase.

Entity Profile

Relationship Graph

Source Code

core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportLoggingProcessorTests.java lines 41–69

@ExtendWith(OutputCaptureExtension.class)
class ConditionEvaluationReportLoggingProcessorTests {

	@Test
	void logsDebugOnProcessAheadOfTime(CapturedOutput output) {
		DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
		ConditionEvaluationReport.get(beanFactory)
			.recordConditionEvaluation("test", mock(Condition.class), ConditionOutcome.match());
		ConditionEvaluationReportLoggingProcessor processor = new ConditionEvaluationReportLoggingProcessor();
		processor.processAheadOfTime(beanFactory);
		assertThat(output).doesNotContain("CONDITIONS EVALUATION REPORT");
		withDebugLogging(() -> processor.processAheadOfTime(beanFactory));
		assertThat(output).contains("CONDITIONS EVALUATION REPORT");
	}

	private void withDebugLogging(Runnable runnable) {
		Logger logger = ((LoggerContext) LoggerFactory.getILoggerFactory())
			.getLogger(ConditionEvaluationReportLogger.class);
		Level currentLevel = logger.getLevel();
		logger.setLevel(Level.DEBUG);
		try {
			runnable.run();
		}
		finally {
			logger.setLevel(currentLevel);
		}
	}

}

Domain

Analyze Your Own Codebase

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

Try Supermodel Free