IncrementalBuildMetadataGenerationTests Class — spring-boot Architecture
Architecture documentation for the IncrementalBuildMetadataGenerationTests class in IncrementalBuildMetadataGenerationTests.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/IncrementalBuildMetadataGenerationTests.java lines 36–103
class IncrementalBuildMetadataGenerationTests extends AbstractMetadataGenerationTests {
@Test
void incrementalBuild() throws Exception {
TestProject project = new TestProject(FooProperties.class, BarProperties.class);
ConfigurationMetadata metadata = project.compile();
assertThat(metadata)
.has(Metadata.withProperty("foo.counter").fromSource(FooProperties.class).withDefaultValue(0));
assertThat(metadata)
.has(Metadata.withProperty("bar.counter").fromSource(BarProperties.class).withDefaultValue(0));
metadata = project.compile();
assertThat(metadata)
.has(Metadata.withProperty("foo.counter").fromSource(FooProperties.class).withDefaultValue(0));
assertThat(metadata)
.has(Metadata.withProperty("bar.counter").fromSource(BarProperties.class).withDefaultValue(0));
project.addSourceCode(BarProperties.class, BarProperties.class.getResourceAsStream("BarProperties.snippet"));
metadata = project.compile();
assertThat(metadata).has(Metadata.withProperty("bar.extra"));
assertThat(metadata).has(Metadata.withProperty("foo.counter").withDefaultValue(0));
assertThat(metadata).has(Metadata.withProperty("bar.counter").withDefaultValue(0));
project.revert(BarProperties.class);
metadata = project.compile();
assertThat(metadata).isNotEqualTo(Metadata.withProperty("bar.extra"));
assertThat(metadata).has(Metadata.withProperty("foo.counter").withDefaultValue(0));
assertThat(metadata).has(Metadata.withProperty("bar.counter").withDefaultValue(0));
}
@Test
void incrementalBuildAnnotationRemoved() {
TestProject project = new TestProject(FooProperties.class, BarProperties.class);
ConfigurationMetadata metadata = project.compile();
assertThat(metadata).has(Metadata.withProperty("foo.counter").withDefaultValue(0));
assertThat(metadata).has(Metadata.withProperty("bar.counter").withDefaultValue(0));
project.replaceText(BarProperties.class, "@TestConfigurationProperties", "//@TestConfigurationProperties");
project.replaceText(FooProperties.class, "@TestConfigurationProperties", "//@TestConfigurationProperties");
metadata = project.compile();
assertThat(metadata).isNull();
}
@Test
void incrementalBuildTypeRenamed() {
TestProject project = new TestProject(FooProperties.class, BarProperties.class);
ConfigurationMetadata metadata = project.compile();
assertThat(metadata)
.has(Metadata.withProperty("foo.counter").fromSource(FooProperties.class).withDefaultValue(0));
assertThat(metadata)
.has(Metadata.withProperty("bar.counter").fromSource(BarProperties.class).withDefaultValue(0));
assertThat(metadata).doesNotHave(Metadata.withProperty("bar.counter").fromSource(RenamedBarProperties.class));
project.delete(BarProperties.class);
project.add(RenamedBarProperties.class);
metadata = project.compile(metadata);
assertThat(metadata)
.has(Metadata.withProperty("foo.counter").fromSource(FooProperties.class).withDefaultValue(0));
assertThat(metadata)
.doesNotHave(Metadata.withProperty("bar.counter").fromSource(BarProperties.class).withDefaultValue(0));
assertThat(metadata)
.has(Metadata.withProperty("bar.counter").withDefaultValue(0).fromSource(RenamedBarProperties.class));
}
@Test
void incrementalBuildDoesNotDeleteItems() {
TestProject project = new TestProject(ClassWithNestedProperties.class, FooProperties.class);
ConfigurationMetadata initialMetadata = project.compile();
ConfigurationMetadata updatedMetadata = project.compile();
assertThat(initialMetadata.getItems()).isEqualTo(updatedMetadata.getItems());
}
}
Domain
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free