Search in sources :

Example 16 with ConfigurationPropertiesBeanDescriptor

use of org.springframework.boot.actuate.context.properties.ConfigurationPropertiesReportEndpoint.ConfigurationPropertiesBeanDescriptor in project spring-boot by spring-projects.

the class ConfigurationPropertiesReportEndpointSerializationTests method testInetAddress.

@Test
void testInetAddress() {
    ApplicationContextRunner contextRunner = new ApplicationContextRunner().withUserConfiguration(AddressedConfig.class).withPropertyValues("foo.address:192.168.1.10");
    contextRunner.run((context) -> {
        ConfigurationPropertiesReportEndpoint endpoint = context.getBean(ConfigurationPropertiesReportEndpoint.class);
        ApplicationConfigurationProperties applicationProperties = endpoint.configurationProperties();
        ConfigurationPropertiesBeanDescriptor foo = applicationProperties.getContexts().get(context.getId()).getBeans().get("foo");
        assertThat(foo).isNotNull();
        assertThat(foo.getPrefix()).isEqualTo("foo");
        Map<String, Object> map = foo.getProperties();
        assertThat(map).isNotNull();
        assertThat(map).hasSize(3);
        assertThat(map.get("address")).isEqualTo("192.168.1.10");
    });
}
Also used : ConfigurationPropertiesBeanDescriptor(org.springframework.boot.actuate.context.properties.ConfigurationPropertiesReportEndpoint.ConfigurationPropertiesBeanDescriptor) ApplicationConfigurationProperties(org.springframework.boot.actuate.context.properties.ConfigurationPropertiesReportEndpoint.ApplicationConfigurationProperties) ApplicationContextRunner(org.springframework.boot.test.context.runner.ApplicationContextRunner) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)16 ApplicationConfigurationProperties (org.springframework.boot.actuate.context.properties.ConfigurationPropertiesReportEndpoint.ApplicationConfigurationProperties)16 ConfigurationPropertiesBeanDescriptor (org.springframework.boot.actuate.context.properties.ConfigurationPropertiesReportEndpoint.ConfigurationPropertiesBeanDescriptor)16 ApplicationContextRunner (org.springframework.boot.test.context.runner.ApplicationContextRunner)16 HashMap (java.util.HashMap)6 Map (java.util.Map)6 ArrayList (java.util.ArrayList)4 List (java.util.List)4 HikariDataSource (com.zaxxer.hikari.HikariDataSource)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 InetAddress (java.net.InetAddress)2 Collections (java.util.Collections)2 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)2 Assertions.entry (org.assertj.core.api.Assertions.entry)2 ContextConfigurationProperties (org.springframework.boot.actuate.context.properties.ConfigurationPropertiesReportEndpoint.ContextConfigurationProperties)2 ConfigurationProperties (org.springframework.boot.context.properties.ConfigurationProperties)2 ConfigurationPropertiesBinding (org.springframework.boot.context.properties.ConfigurationPropertiesBinding)2 EnableConfigurationProperties (org.springframework.boot.context.properties.EnableConfigurationProperties)2