use of org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata in project spring-boot by spring-projects.
the class ConfigurationMetadataAnnotationProcessorTests method simplePrefixValueProperties.
@Test
public void simplePrefixValueProperties() throws Exception {
ConfigurationMetadata metadata = compile(SimplePrefixValueProperties.class);
assertThat(metadata).has(Metadata.withGroup("simple").fromSource(SimplePrefixValueProperties.class));
assertThat(metadata).has(Metadata.withProperty("simple.name", String.class).fromSource(SimplePrefixValueProperties.class));
}
use of org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata in project spring-boot by spring-projects.
the class ConfigurationMetadataAnnotationProcessorTests method innerClassProperties.
@Test
public void innerClassProperties() throws Exception {
ConfigurationMetadata metadata = compile(InnerClassProperties.class);
assertThat(metadata).has(Metadata.withGroup("config").fromSource(InnerClassProperties.class));
assertThat(metadata).has(Metadata.withGroup("config.first").ofType(InnerClassProperties.Foo.class).fromSource(InnerClassProperties.class));
assertThat(metadata).has(Metadata.withProperty("config.first.name"));
assertThat(metadata).has(Metadata.withProperty("config.first.bar.name"));
assertThat(metadata).has(Metadata.withGroup("config.the-second", InnerClassProperties.Foo.class).fromSource(InnerClassProperties.class));
assertThat(metadata).has(Metadata.withProperty("config.the-second.name"));
assertThat(metadata).has(Metadata.withProperty("config.the-second.bar.name"));
assertThat(metadata).has(Metadata.withGroup("config.third").ofType(SimplePojo.class).fromSource(InnerClassProperties.class));
assertThat(metadata).has(Metadata.withProperty("config.third.value"));
assertThat(metadata).has(Metadata.withProperty("config.fourth"));
assertThat(metadata).isNotEqualTo(Metadata.withGroup("config.fourth"));
}
use of org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata in project spring-boot by spring-projects.
the class ConfigurationMetadataAnnotationProcessorTests method boxingOnSetter.
@Test
public void boxingOnSetter() throws IOException {
Class<?> type = BoxingPojo.class;
ConfigurationMetadata metadata = compile(type);
assertThat(metadata).has(Metadata.withGroup("boxing").fromSource(type));
assertThat(metadata).has(Metadata.withProperty("boxing.flag", Boolean.class).fromSource(type));
assertThat(metadata).has(Metadata.withProperty("boxing.counter", Integer.class).fromSource(type));
}
use of org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata in project spring-boot by spring-projects.
the class ConfigurationMetadataAnnotationProcessorTests method invalidAccessor.
@Test
public void invalidAccessor() throws IOException {
ConfigurationMetadata metadata = compile(InvalidAccessorProperties.class);
assertThat(metadata).has(Metadata.withGroup("config"));
assertThat(metadata.getItems()).hasSize(1);
}
use of org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata in project spring-boot by spring-projects.
the class ConfigurationMetadataAnnotationProcessorTests method mergingOfSimpleHint.
@Test
public void mergingOfSimpleHint() throws Exception {
writeAdditionalHints(ItemHint.newHint("simple.the-name", new ItemHint.ValueHint("boot", "Bla bla"), new ItemHint.ValueHint("spring", null)));
ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(metadata).has(Metadata.withProperty("simple.the-name", String.class).fromSource(SimpleProperties.class).withDescription("The name of this simple properties.").withDefaultValue("boot").withDeprecation(null, null));
assertThat(metadata).has(Metadata.withHint("simple.the-name").withValue(0, "boot", "Bla bla").withValue(1, "spring", null));
}
Aggregations