|
|
|
@ -166,6 +166,16 @@ class ValueObjectBinderTests {
|
|
|
|
|
assertThat(bean.getDate().toString()).isEqualTo("2019-05-10");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void bindToClassWhenHasPackagePrivateConstructorShouldBind() {
|
|
|
|
|
MockConfigurationPropertySource source = new MockConfigurationPropertySource();
|
|
|
|
|
source.put("foo.property", "test");
|
|
|
|
|
this.sources.add(source);
|
|
|
|
|
ExamplePackagePrivateConstructorBean bound = this.binder
|
|
|
|
|
.bind("foo", Bindable.of(ExamplePackagePrivateConstructorBean.class)).get();
|
|
|
|
|
assertThat(bound.getProperty()).isEqualTo("test");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void createShouldReturnCreatedValue() {
|
|
|
|
|
ExampleValueBean value = this.binder.bindOrCreate("foo", Bindable.of(ExampleValueBean.class));
|
|
|
|
@ -370,4 +380,18 @@ class ValueObjectBinderTests {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class ExamplePackagePrivateConstructorBean {
|
|
|
|
|
|
|
|
|
|
private final String property;
|
|
|
|
|
|
|
|
|
|
ExamplePackagePrivateConstructorBean(String property) {
|
|
|
|
|
this.property = property;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getProperty() {
|
|
|
|
|
return this.property;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|