@ -1,5 +1,5 @@
/ *
/ *
* Copyright 2012 - 20 19 the original author or authors .
* Copyright 2012 - 20 2 1 the original author or authors .
*
*
* Licensed under the Apache License , Version 2.0 ( the "License" ) ;
* Licensed under the Apache License , Version 2.0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
* you may not use this file except in compliance with the License .
@ -42,10 +42,11 @@ class ConfigurationPropertiesReportEndpointFilteringTests {
contextRunner . run ( ( context ) - > {
contextRunner . run ( ( context ) - > {
ConfigurationPropertiesReportEndpoint endpoint = context
ConfigurationPropertiesReportEndpoint endpoint = context
. getBean ( ConfigurationPropertiesReportEndpoint . class ) ;
. getBean ( ConfigurationPropertiesReportEndpoint . class ) ;
ApplicationConfigurationProperties applicationProperties = endpoint . configurationProperties ( "only.bar" ) ;
ApplicationConfigurationProperties applicationProperties = endpoint
. configurationPropertiesWithPrefix ( "only.bar" ) ;
assertThat ( applicationProperties . getContexts ( ) ) . containsOnlyKeys ( context . getId ( ) ) ;
assertThat ( applicationProperties . getContexts ( ) ) . containsOnlyKeys ( context . getId ( ) ) ;
ContextConfigurationProperties contextProperties = applicationProperties . getContexts ( ) . get ( context . getId ( ) ) ;
ContextConfigurationProperties contextProperties = applicationProperties . getContexts ( ) . get ( context . getId ( ) ) ;
assertThat ( contextProperties . getBeans ( ) . values ( ) ) . hasSize( 1 ) . firs t( ) . hasFieldOrPropertyWithValue ( "prefix" ,
assertThat ( contextProperties . getBeans ( ) . values ( ) ) . singleElemen t( ) . hasFieldOrPropertyWithValue ( "prefix" ,
"only.bar" ) ;
"only.bar" ) ;
} ) ;
} ) ;
}
}
@ -57,7 +58,8 @@ class ConfigurationPropertiesReportEndpointFilteringTests {
contextRunner . run ( ( context ) - > {
contextRunner . run ( ( context ) - > {
ConfigurationPropertiesReportEndpoint endpoint = context
ConfigurationPropertiesReportEndpoint endpoint = context
. getBean ( ConfigurationPropertiesReportEndpoint . class ) ;
. getBean ( ConfigurationPropertiesReportEndpoint . class ) ;
ApplicationConfigurationProperties applicationProperties = endpoint . configurationProperties ( "foo." ) ;
ApplicationConfigurationProperties applicationProperties = endpoint
. configurationPropertiesWithPrefix ( "foo." ) ;
assertThat ( applicationProperties . getContexts ( ) ) . containsOnlyKeys ( context . getId ( ) ) ;
assertThat ( applicationProperties . getContexts ( ) ) . containsOnlyKeys ( context . getId ( ) ) ;
ContextConfigurationProperties contextProperties = applicationProperties . getContexts ( ) . get ( context . getId ( ) ) ;
ContextConfigurationProperties contextProperties = applicationProperties . getContexts ( ) . get ( context . getId ( ) ) ;
assertThat ( contextProperties . getBeans ( ) ) . containsOnlyKeys ( "primaryFoo" , "secondaryFoo" ) ;
assertThat ( contextProperties . getBeans ( ) ) . containsOnlyKeys ( "primaryFoo" , "secondaryFoo" ) ;
@ -71,7 +73,8 @@ class ConfigurationPropertiesReportEndpointFilteringTests {
contextRunner . run ( ( context ) - > {
contextRunner . run ( ( context ) - > {
ConfigurationPropertiesReportEndpoint endpoint = context
ConfigurationPropertiesReportEndpoint endpoint = context
. getBean ( ConfigurationPropertiesReportEndpoint . class ) ;
. getBean ( ConfigurationPropertiesReportEndpoint . class ) ;
ApplicationConfigurationProperties applicationProperties = endpoint . configurationProperties ( "foo.third" ) ;
ApplicationConfigurationProperties applicationProperties = endpoint
. configurationPropertiesWithPrefix ( "foo.third" ) ;
assertThat ( applicationProperties . getContexts ( ) ) . containsOnlyKeys ( context . getId ( ) ) ;
assertThat ( applicationProperties . getContexts ( ) ) . containsOnlyKeys ( context . getId ( ) ) ;
ContextConfigurationProperties contextProperties = applicationProperties . getContexts ( ) . get ( context . getId ( ) ) ;
ContextConfigurationProperties contextProperties = applicationProperties . getContexts ( ) . get ( context . getId ( ) ) ;
assertThat ( contextProperties . getBeans ( ) ) . isEmpty ( ) ;
assertThat ( contextProperties . getBeans ( ) ) . isEmpty ( ) ;