2424
2525import org .junit .jupiter .api .Test ;
2626
27+ import org .springframework .lang .Nullable ;
28+
2729import static org .assertj .core .api .Assertions .assertThat ;
2830
2931/**
3436 */
3537class CustomEnvironmentTests {
3638
37- // -- tests relating to customizing reserved default profiles ----------------------
38-
3939@ Test
4040void control () {
4141Environment env = new AbstractEnvironment () { };
@@ -111,11 +111,12 @@ protected Set<String> getReservedDefaultProfiles() {
111111public void withNoProfileProperties () {
112112ConfigurableEnvironment env = new AbstractEnvironment () {
113113@ Override
114+ @ Nullable
114115protected String doGetActiveProfilesProperty () {
115116return null ;
116117}
117-
118118@ Override
119+ @ Nullable
119120protected String doGetDefaultProfilesProperty () {
120121return null ;
121122}
@@ -140,23 +141,23 @@ class CustomMutablePropertySources extends MutablePropertySources {}
140141@ Test
141142void withCustomPropertyResolver () {
142143class CustomPropertySourcesPropertyResolver extends PropertySourcesPropertyResolver {
143- public CustomPropertySourcesPropertyResolver (
144- PropertySources propertySources ) {
144+ public CustomPropertySourcesPropertyResolver (PropertySources propertySources ) {
145145super (propertySources );
146146}
147-
148147@ Override
148+ @ Nullable
149149public String getProperty (String key ) {
150150return super .getProperty (key )+"-test" ;
151151}
152152}
153+
153154ConfigurableEnvironment env = new AbstractEnvironment () {
154155@ Override
155- protected ConfigurablePropertyResolver createPropertyResolver (
156- MutablePropertySources propertySources ) {
156+ protected ConfigurablePropertyResolver createPropertyResolver (MutablePropertySources propertySources ) {
157157return new CustomPropertySourcesPropertyResolver (propertySources );
158158}
159159};
160+
160161Map <String , Object > values = new LinkedHashMap <>();
161162values .put ("spring" , "framework" );
162163PropertySource <?> propertySource = new MapPropertySource ("test" , values );
@@ -168,6 +169,4 @@ private Profiles defaultProfile() {
168169return Profiles .of (AbstractEnvironment .RESERVED_DEFAULT_PROFILE_NAME );
169170}
170171
171-
172- // -- tests relating to customizing property sources -------------------------------
173172}
0 commit comments