Home / Class/ AbstractMetadataGenerationTests Class — spring-boot Architecture

AbstractMetadataGenerationTests Class — spring-boot Architecture

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

Entity Profile

Relationship Graph

Source Code

configuration-metadata/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/AbstractMetadataGenerationTests.java lines 36–74

public abstract class AbstractMetadataGenerationTests {

	private static final String ADDITIONAL_METADATA_FILE = "META-INF/additional-spring-configuration-metadata.json";

	protected ConfigurationMetadata compile(Class<?>... types) {
		TestCompiler compiler = TestCompiler.forSystem().withSources(sourceFilesOf(types));
		return compile(compiler);
	}

	protected ConfigurationMetadata compile(String additionalMetadata, Class<?> type, Class<?>... types) {
		TestCompiler compiler = TestCompiler.forSystem()
			.withSources(sourceFilesOf(type))
			.withSources(sourceFilesOf(types))
			.withResources(ResourceFile.of(ADDITIONAL_METADATA_FILE, additionalMetadata));
		return compile(compiler);
	}

	protected ConfigurationMetadata compile(String... source) {
		TestCompiler compiler = TestCompiler.forSystem().withSources(sourceFilesOf(source));
		return compile(compiler);
	}

	private ConfigurationMetadata compile(TestCompiler compiler) {
		TestConfigurationMetadataAnnotationProcessor processor = new TestConfigurationMetadataAnnotationProcessor();
		compiler = compiler.withProcessors(processor);
		AtomicReference<ConfigurationMetadata> configurationMetadata = new AtomicReference<>();
		compiler.compile((compiled) -> configurationMetadata.set(CompiledMetadataReader.getMetadata(compiled)));
		return configurationMetadata.get();
	}

	private List<SourceFile> sourceFilesOf(Class<?>... types) {
		return Arrays.stream(types).map(SourceFile::forTestClass).toList();
	}

	private List<SourceFile> sourceFilesOf(String... content) {
		return Arrays.stream(content).map(SourceFile::of).toList();
	}

}

Domain

Analyze Your Own Codebase

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

Try Supermodel Free