use of org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata in project spring-boot by spring-projects.
the class DeducedImmutablePropertiesMetadataGenerationTests method immutableSimpleProperties.
@Test
void immutableSimpleProperties() {
ConfigurationMetadata metadata = compile(DeducedImmutableClassProperties.class);
assertThat(metadata).has(Metadata.withGroup("test").fromSource(DeducedImmutableClassProperties.class));
assertThat(metadata).has(Metadata.withGroup("test.nested", DeducedImmutableClassProperties.Nested.class).fromSource(DeducedImmutableClassProperties.class));
assertThat(metadata).has(Metadata.withProperty("test.nested.name", String.class).fromSource(DeducedImmutableClassProperties.Nested.class));
ItemMetadata nestedMetadata = metadata.getItems().stream().filter((item) -> item.getName().equals("test.nested")).findFirst().get();
assertThat(nestedMetadata.getDefaultValue()).isNull();
}
use of org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata in project spring-boot by spring-projects.
the class GenericsMetadataGenerationTests method complexGenericProperties.
@Test
void complexGenericProperties() {
ConfigurationMetadata metadata = compile(ComplexGenericProperties.class);
assertThat(metadata).has(Metadata.withGroup("generic").fromSource(ComplexGenericProperties.class));
assertThat(metadata).has(Metadata.withGroup("generic.test").ofType(UpperBoundGenericPojo.class).fromSource(ComplexGenericProperties.class));
assertThat(metadata).has(Metadata.withProperty("generic.test.mappings", "java.util.Map<java.lang.Enum<T>,java.lang.String>").fromSource(UpperBoundGenericPojo.class));
assertThat(metadata.getItems()).hasSize(3);
}
use of org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata in project spring-boot by spring-projects.
the class GenericsMetadataGenerationTests method unresolvedGenericProperties.
@Test
void unresolvedGenericProperties() {
ConfigurationMetadata metadata = compile(AbstractGenericProperties.class, UnresolvedGenericProperties.class);
assertThat(metadata).has(Metadata.withGroup("generic").fromSource(UnresolvedGenericProperties.class));
assertThat(metadata).has(Metadata.withProperty("generic.name", String.class).fromSource(UnresolvedGenericProperties.class).withDescription("Generic name.").withDefaultValue(null));
assertThat(metadata).has(Metadata.withProperty("generic.mappings", "java.util.Map<java.lang.Number,java.lang.Object>").fromSource(UnresolvedGenericProperties.class).withDescription("Generic mappings.").withDefaultValue(null));
assertThat(metadata.getItems()).hasSize(3);
}
use of org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata in project spring-boot by spring-projects.
the class GenericsMetadataGenerationTests method genericTypes.
@Test
void genericTypes() {
ConfigurationMetadata metadata = compile(GenericConfig.class);
assertThat(metadata).has(Metadata.withGroup("generic").ofType("org.springframework.boot.configurationsample.generic.GenericConfig"));
assertThat(metadata).has(Metadata.withGroup("generic.foo").ofType("org.springframework.boot.configurationsample.generic.GenericConfig$Foo"));
assertThat(metadata).has(Metadata.withGroup("generic.foo.bar").ofType("org.springframework.boot.configurationsample.generic.GenericConfig$Bar"));
assertThat(metadata).has(Metadata.withGroup("generic.foo.bar.biz").ofType("org.springframework.boot.configurationsample.generic.GenericConfig$Bar$Biz"));
assertThat(metadata).has(Metadata.withProperty("generic.foo.name").ofType(String.class).fromSource(GenericConfig.Foo.class));
assertThat(metadata).has(Metadata.withProperty("generic.foo.string-to-bar").ofType("java.util.Map<java.lang.String,org.springframework.boot.configurationsample.generic.GenericConfig$Bar<java.lang.Integer>>").fromSource(GenericConfig.Foo.class));
assertThat(metadata).has(Metadata.withProperty("generic.foo.string-to-integer").ofType("java.util.Map<java.lang.String,java.lang.Integer>").fromSource(GenericConfig.Foo.class));
assertThat(metadata).has(Metadata.withProperty("generic.foo.bar.name").ofType("java.lang.String").fromSource(GenericConfig.Bar.class));
assertThat(metadata).has(Metadata.withProperty("generic.foo.bar.biz.name").ofType("java.lang.String").fromSource(GenericConfig.Bar.Biz.class));
assertThat(metadata.getItems()).hasSize(9);
}
use of org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata in project spring-boot by spring-projects.
the class GenericsMetadataGenerationTests method simpleGenericProperties.
@Test
void simpleGenericProperties() {
ConfigurationMetadata metadata = compile(AbstractGenericProperties.class, SimpleGenericProperties.class);
assertThat(metadata).has(Metadata.withGroup("generic").fromSource(SimpleGenericProperties.class));
assertThat(metadata).has(Metadata.withProperty("generic.name", String.class).fromSource(SimpleGenericProperties.class).withDescription("Generic name.").withDefaultValue(null));
assertThat(metadata).has(Metadata.withProperty("generic.mappings", "java.util.Map<java.lang.Integer,java.time.Duration>").fromSource(SimpleGenericProperties.class).withDescription("Generic mappings.").withDefaultValue(null));
assertThat(metadata.getItems()).hasSize(3);
}
Aggregations