Search in sources :

Example 1 with HierarchicalProperties

use of org.springframework.boot.configurationsample.simple.HierarchicalProperties in project spring-boot by spring-projects.

the class ConfigurationMetadataAnnotationProcessorTests method hierarchicalProperties.

@Test
void hierarchicalProperties() {
    ConfigurationMetadata metadata = compile(HierarchicalProperties.class, HierarchicalPropertiesParent.class, HierarchicalPropertiesGrandparent.class);
    assertThat(metadata).has(Metadata.withGroup("hierarchical").fromSource(HierarchicalProperties.class));
    assertThat(metadata).has(Metadata.withProperty("hierarchical.first", String.class).withDefaultValue("one").fromSource(HierarchicalProperties.class));
    assertThat(metadata).has(Metadata.withProperty("hierarchical.second", String.class).withDefaultValue("two").fromSource(HierarchicalProperties.class));
    assertThat(metadata).has(Metadata.withProperty("hierarchical.third", String.class).withDefaultValue("three").fromSource(HierarchicalProperties.class));
}
Also used : HierarchicalProperties(org.springframework.boot.configurationsample.simple.HierarchicalProperties) InnerClassHierarchicalProperties(org.springframework.boot.configurationsample.specific.InnerClassHierarchicalProperties) ConfigurationMetadata(org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 ConfigurationMetadata (org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata)1 HierarchicalProperties (org.springframework.boot.configurationsample.simple.HierarchicalProperties)1 InnerClassHierarchicalProperties (org.springframework.boot.configurationsample.specific.InnerClassHierarchicalProperties)1