SourceTests Class — spring-boot Architecture
Architecture documentation for the SourceTests class in ConfigurationMetadataAnnotationProcessorTests.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/ConfigurationMetadataAnnotationProcessorTests.java lines 638–764
@Nested
class SourceTests {
@Test
void javaBeansSourceIsMergedWithNestedConfigurationProperty() {
ConfigurationMetadata metadata = compile(SimpleSourceAnnotated.class, SimpleSource.class);
assertThat(metadata).has(Metadata.withGroup("example.nested", SimpleSource.class))
.has(Metadata.withProperty("example.nested.name", String.class).withDescription("Name description."))
.has(Metadata.withProperty("example.nested.description", String.class)
.withDescription("Description description.")
.withDefaultValue("Hello World"))
.has(Metadata.withProperty("example.nested.type", String.class)
.withDescription("A property with a fixed set of values.")
.withDefaultValue("single"));
}
@Test
void lombokSourceIsMergedWithNestedConfigurationProperty() {
ConfigurationMetadata metadata = compile(LombokSourceAnnotated.class, LombokSource.class);
assertThat(metadata).has(Metadata.withGroup("example.nested", LombokSource.class))
.has(Metadata.withProperty("example.nested.name", String.class).withDescription("Name description."))
.has(Metadata.withProperty("example.nested.description", String.class)
.withDescription("Description description.")
.withDefaultValue("Hello World"))
.has(Metadata.withProperty("example.nested.type", String.class)
.withDescription("A property with a fixed set of values.")
.withDefaultValue("single"));
}
@Test
void immutableSourceIsMergedWithNestedConfigurationProperty() {
ConfigurationMetadata metadata = compile(ImmutableSourceAnnotated.class, ImmutableSource.class);
assertThat(metadata).has(Metadata.withGroup("example.nested", ImmutableSource.class))
.has(Metadata.withProperty("example.nested.name", String.class).withDescription("Name description."))
.has(Metadata.withProperty("example.nested.description", String.class)
.withDescription("Description description.")
.withDefaultValue("Hello World"))
.has(Metadata.withProperty("example.nested.type", String.class)
.withDescription("A property with a fixed set of values.")
.withDefaultValue("single"));
}
@Test
void recordSourceIsMergedWithNestedConfigurationProperty() {
ConfigurationMetadata metadata = compile(RecordSourceAnnotated.class, RecordSource.class);
assertThat(metadata).has(Metadata.withGroup("example.nested", RecordSource.class))
.has(Metadata.withProperty("example.nested.name", String.class).withDescription("Name description."))
.has(Metadata.withProperty("example.nested.description", String.class)
.withDescription("Description description.")
.withDefaultValue("Hello World"))
.has(Metadata.withProperty("example.nested.type", String.class)
.withDescription("A property with a fixed set of values.")
.withDefaultValue("single"));
}
@Test
void sourceIsMergedWithConfigurationProperties() {
ConfigurationMetadata metadata = compile(ParentWithHintProperties.class);
assertThat(metadata).has(Metadata.withGroup("example", ParentWithHintProperties.class))
.has(Metadata.withProperty("example.name", String.class).withDescription("Name description."))
.has(Metadata.withProperty("example.description", String.class)
.withDescription("Description description.")
.withDefaultValue("Hello World"))
.has(Metadata.withProperty("example.type", String.class)
.withDescription("A property with a fixed set of values.")
.withDefaultValue("single"))
.has(Metadata.withProperty("example.enabled", Boolean.class)
.withDescription("Whether this is enabled.")
.withDefaultValue(false));
}
@Test
void sourceHintIsMergedWithNestedConfigurationProperty() {
ConfigurationMetadata metadata = compile(SimpleSourceAnnotated.class);
assertThat(metadata).has(Metadata.withHint("example.nested.type")
.withValue(0, "auto", "Detect the type automatically.")
.withValue(1, "single", "Single type.")
.withValue(2, "multi", "Multi type."));
}
@Test
void sourceHintIsMergedWithConfigurationProperties() {
ConfigurationMetadata metadata = compile(ParentWithHintProperties.class);
assertThat(metadata).has(Metadata.withHint("example.type")
.withValue(0, "auto", "Detect the type automatically.")
.withValue(1, "single", "Single type.")
.withValue(2, "multi", "Multi type."));
}
@Test
void sourceWithNonCanonicalMetadataIsDiscovered() {
ConfigurationMetadata metadata = compile(ConventionSourceAnnotated.class);
assertThat(metadata).has(Metadata.withGroup("example.nested", ConventionSource.class))
.has(Metadata.withProperty("example.nested.first-name", String.class).withDescription("Camel case."))
.has(Metadata.withProperty("example.nested.last-name", String.class)
.withDescription("Canonical format."));
assertThat(metadata.getItems()).hasSize(4);
}
@Test
void sourceFromParentClasIsDiscoveredForConcreteSource() {
ConfigurationMetadata metadata = compile(ConcreteSourceAnnotated.class, ConcreteSource.class);
assertThat(metadata).has(Metadata.withGroup("example", ConcreteSourceAnnotated.class))
.has(Metadata.withGroup("example.nested", ConcreteSource.class))
.has(Metadata.withProperty("example.nested.enabled", Boolean.class)
.withDescription("Whether the feature is enabled."))
.has(Metadata.withProperty("example.nested.username", String.class)
.withDescription("User name.")
.withDefaultValue("user"))
.has(Metadata.withProperty("example.nested.password", String.class).withDescription("Password."));
assertThat(metadata.getItems()).hasSize(5);
}
@Test
void sourceFromParentClasIsDiscoveredForConfigurationProperties() {
ConfigurationMetadata metadata = compile(ConcreteProperties.class);
assertThat(metadata).has(Metadata.withGroup("example", ConcreteProperties.class))
.has(Metadata.withProperty("example.enabled", Boolean.class)
.withDescription("Whether the feature is enabled."))
.has(Metadata.withProperty("example.username", String.class)
.withDescription("User name.")
.withDefaultValue("user"))
.has(Metadata.withProperty("example.password", String.class).withDescription("Password."));
assertThat(metadata.getItems()).hasSize(4);
}
}
Domain
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free