@@ -152,10 +152,12 @@ void containsDescendantOfShouldCheckSourceNames() {
152
152
}
153
153
154
154
@ Test
155
- void containsDescendantOfWhenSystemEnvironmentPropertySourceShouldLegacyProperty () {
155
+ void containsDescendantOfWhenSystemEnvironmentPropertySourceShouldSupportLegacyProperty () {
156
156
Map <String , Object > source = new LinkedHashMap <>();
157
157
source .put ("FOO_BAR_BAZ_BONG" , "bing" );
158
158
source .put ("FOO_ALPHABRAVO_GAMMA" , "delta" );
159
+ source .put ("loo_bar_baz_bong" , "bing" );
160
+ source .put ("loo_alphabravo_gamma" , "delta" );
159
161
SystemEnvironmentPropertySource propertySource = new SystemEnvironmentPropertySource (
160
162
StandardEnvironment .SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME , source );
161
163
SpringIterableConfigurationPropertySource adapter = new SpringIterableConfigurationPropertySource (
@@ -166,6 +168,27 @@ void containsDescendantOfWhenSystemEnvironmentPropertySourceShouldLegacyProperty
166
168
.isEqualTo (ConfigurationPropertyState .PRESENT );
167
169
assertThat (adapter .containsDescendantOf (ConfigurationPropertyName .of ("foo.blah" )))
168
170
.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" );
169
192
}
170
193
171
194
@ Test
0 commit comments