Search in sources :

Example 1 with ItemHint

use of org.springframework.boot.configurationprocessor.metadata.ItemHint in project spring-boot by spring-projects.

the class ConfigurationMetadataAnnotationProcessorTests method mergingOfHintWithProvider.

@Test
public void mergingOfHintWithProvider() throws Exception {
    writeAdditionalHints(new ItemHint("simple.theName", Collections.<ItemHint.ValueHint>emptyList(), Arrays.asList(new ItemHint.ValueProvider("first", Collections.<String, Object>singletonMap("target", "org.foo")), new ItemHint.ValueProvider("second", 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").withProvider("first", "target", "org.foo").withProvider("second"));
}
Also used : JSONObject(org.json.JSONObject) ItemHint(org.springframework.boot.configurationprocessor.metadata.ItemHint) ConfigurationMetadata(org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata) Test(org.junit.Test)

Example 2 with ItemHint

use of org.springframework.boot.configurationprocessor.metadata.ItemHint in project spring-boot by spring-projects.

the class MergeMetadataGenerationTests method mergingOfHintWithProvider.

@Test
void mergingOfHintWithProvider() throws Exception {
    writeAdditionalHints(new ItemHint("simple.theName", Collections.emptyList(), Arrays.asList(new ItemHint.ValueProvider("first", Collections.singletonMap("target", "org.foo")), new ItemHint.ValueProvider("second", 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").withProvider("first", "target", "org.foo").withProvider("second"));
}
Also used : ItemHint(org.springframework.boot.configurationprocessor.metadata.ItemHint) ConfigurationMetadata(org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata) Test(org.junit.jupiter.api.Test)

Aggregations

ConfigurationMetadata (org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata)2 ItemHint (org.springframework.boot.configurationprocessor.metadata.ItemHint)2 JSONObject (org.json.JSONObject)1 Test (org.junit.Test)1 Test (org.junit.jupiter.api.Test)1