@@ -152,10 +152,12 @@ void containsDescendantOfShouldCheckSourceNames() {
152152 }
153153
154154 @ Test
155- void containsDescendantOfWhenSystemEnvironmentPropertySourceShouldLegacyProperty () {
155+ void containsDescendantOfWhenSystemEnvironmentPropertySourceShouldSupportLegacyProperty () {
156156 Map <String , Object > source = new LinkedHashMap <>();
157157 source .put ("FOO_BAR_BAZ_BONG" , "bing" );
158158 source .put ("FOO_ALPHABRAVO_GAMMA" , "delta" );
159+ source .put ("loo_bar_baz_bong" , "bing" );
160+ source .put ("loo_alphabravo_gamma" , "delta" );
159161 SystemEnvironmentPropertySource propertySource = new SystemEnvironmentPropertySource (
160162 StandardEnvironment .SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME , source );
161163 SpringIterableConfigurationPropertySource adapter = new SpringIterableConfigurationPropertySource (
@@ -166,6 +168,27 @@ void containsDescendantOfWhenSystemEnvironmentPropertySourceShouldLegacyProperty
166168 .isEqualTo (ConfigurationPropertyState .PRESENT );
167169 assertThat (adapter .containsDescendantOf (ConfigurationPropertyName .of ("foo.blah" )))
168170 .isEqualTo (ConfigurationPropertyState .ABSENT );
171+ assertThat (adapter .containsDescendantOf (ConfigurationPropertyName .of ("loo.bar-baz" )))
172+ .isEqualTo (ConfigurationPropertyState .PRESENT );
173+ assertThat (adapter .containsDescendantOf (ConfigurationPropertyName .of ("loo.alpha-bravo" )))
174+ .isEqualTo (ConfigurationPropertyState .PRESENT );
175+ assertThat (adapter .containsDescendantOf (ConfigurationPropertyName .of ("loo.blah" )))
176+ .isEqualTo (ConfigurationPropertyState .ABSENT );
177+ }
178+
179+ @ Test
180+ void getConfigurationPropertyWhenSystemEnvironmentPropertySourceShouldSupportLegacyProperty () {
181+ Map <String , Object > source = new LinkedHashMap <>();
182+ source .put ("TEST_VALUE_UPPER" , "upper" );
183+ source .put ("test_value_lower" , "lower" );
184+ SystemEnvironmentPropertySource propertySource = new SystemEnvironmentPropertySource (
185+ StandardEnvironment .SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME , source );
186+ SpringIterableConfigurationPropertySource adapter = new SpringIterableConfigurationPropertySource (
187+ propertySource , SystemEnvironmentPropertyMapper .INSTANCE , DefaultPropertyMapper .INSTANCE );
188+ assertThat (adapter .getConfigurationProperty (ConfigurationPropertyName .of ("test.value-upper" )).getValue ())
189+ .isEqualTo ("upper" );
190+ assertThat (adapter .getConfigurationProperty (ConfigurationPropertyName .of ("test.value-lower" )).getValue ())
191+ .isEqualTo ("lower" );
169192 }
170193
171194 @ Test
0 commit comments