This commit is contained in:
Phillip Webb 2017-04-28 14:20:56 -07:00
parent 0759652b24
commit 528d776d2b
1 changed files with 4 additions and 3 deletions

View File

@ -139,14 +139,15 @@ public class BinderTests {
}
@Test
public void bindToValueWithMissingPlaceholdersShouldThrowException() throws Exception {
public void bindToValueWithMissingPlaceholdersShouldThrowException()
throws Exception {
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.thrown.expectCause(ThrowableMessageMatcher.hasMessage(containsString(
"Could not resolve placeholder 'bar' in value \"${bar}\"")));
this.binder.bind("foo", Bindable.of(Integer.class));
}