@ -30,7 +30,6 @@ import org.assertj.core.matcher.AssertionMatcher;
@@ -30,7 +30,6 @@ import org.assertj.core.matcher.AssertionMatcher;
import org.junit.Before ;
import org.junit.Rule ;
import org.junit.Test ;
import org.junit.internal.matchers.ThrowableMessageMatcher ;
import org.junit.rules.ExpectedException ;
import org.mockito.Answers ;
import org.mockito.InOrder ;
@ -53,7 +52,6 @@ import org.springframework.validation.annotation.Validated;
@@ -53,7 +52,6 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.validation.beanvalidation.SpringValidatorAdapter ;
import static org.assertj.core.api.Assertions.assertThat ;
import static org.hamcrest.Matchers.containsString ;
import static org.hamcrest.Matchers.instanceOf ;
import static org.mockito.ArgumentMatchers.any ;
import static org.mockito.ArgumentMatchers.eq ;
@ -153,15 +151,13 @@ public class BinderTests {
@@ -153,15 +151,13 @@ public class BinderTests {
}
@Test
public void bindToValueWithMissingPlaceholdersShouldThrowException ( ) {
public void bindToValueWithMissingPlaceholderShouldResolveToValueWithPlaceholder ( ) {
StandardEnvironment environment = new StandardEnvironment ( ) ;
this . sources . add ( new MockConfigurationPropertySource ( "foo" , "${bar}" ) ) ;
this . binder = new Binder ( this . sources ,
new PropertySourcesPlaceholdersResolver ( environment ) ) ;
this . thrown . expect ( BindException . class ) ;
this . thrown . expectCause ( ThrowableMessageMatcher . hasMessage ( containsString (
"Could not resolve placeholder 'bar' in value \"${bar}\"" ) ) ) ;
this . binder . bind ( "foo" , Bindable . of ( Integer . class ) ) ;
BindResult < String > result = this . binder . bind ( "foo" , Bindable . of ( String . class ) ) ;
assertThat ( result . get ( ) ) . isEqualTo ( "${bar}" ) ;
}
@Test