@ -27,9 +27,10 @@ import org.springframework.core.env.MapPropertySource;
@@ -27,9 +27,10 @@ import org.springframework.core.env.MapPropertySource;
import org.springframework.core.env.MutablePropertySources ;
import org.springframework.mock.env.MockEnvironment ;
import org.springframework.test.context.support.TestPropertySourceUtils ;
import org.springframework.util.PlaceholderResolutionException ;
import static org.assertj.core.api.Assertions.assertThat ;
import static org.assertj.core.api.Assertions.assertThatIllegalArgument Exception ;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType ;
/ * *
* Tests for { @link SpringBootTestRandomPortEnvironmentPostProcessor } .
@ -169,7 +170,7 @@ class SpringBootTestRandomPortEnvironmentPostProcessorTests {
@@ -169,7 +170,7 @@ class SpringBootTestRandomPortEnvironmentPostProcessorTests {
addTestPropertySource ( "0" , null ) ;
this . propertySources
. addLast ( new MapPropertySource ( "other" , Collections . singletonMap ( "management.server.port" , "${port}" ) ) ) ;
assertThatIllegalArgumentException ( )
assertThatExceptionOfType ( PlaceholderResolutionException . class )
. isThrownBy ( ( ) - > this . postProcessor . postProcessEnvironment ( this . environment , null ) )
. withMessage ( "Could not resolve placeholder 'port' in value \"${port}\"" ) ;
}
@ -196,7 +197,7 @@ class SpringBootTestRandomPortEnvironmentPostProcessorTests {
@@ -196,7 +197,7 @@ class SpringBootTestRandomPortEnvironmentPostProcessorTests {
source . put ( "server.port" , "${port}" ) ;
source . put ( "management.server.port" , "9090" ) ;
this . propertySources . addLast ( new MapPropertySource ( "other" , source ) ) ;
assertThatIllegalArgumentException ( )
assertThatExceptionOfType ( PlaceholderResolutionException . class )
. isThrownBy ( ( ) - > this . postProcessor . postProcessEnvironment ( this . environment , null ) )
. withMessage ( "Could not resolve placeholder 'port' in value \"${port}\"" ) ;
}