Search in sources :

Example 1 with TargetWithNestedObject

use of org.springframework.boot.bind.RelaxedDataBinderTests.TargetWithNestedObject in project spring-boot by spring-projects.

the class BindingPreparationTests method testBeanWrapperCreatesNewObjects.

@Test
public void testBeanWrapperCreatesNewObjects() throws Exception {
    TargetWithNestedObject target = new TargetWithNestedObject();
    BeanWrapperImpl wrapper = new BeanWrapperImpl(target);
    wrapper.setAutoGrowNestedPaths(true);
    // For a nested object, you have to set a property for it to be created
    wrapper.setPropertyValue("nested.foo", "bar");
    wrapper.getPropertyValue("nested");
    assertThat(wrapper.getPropertyValue("nested")).isNotNull();
}
Also used : TargetWithNestedObject(org.springframework.boot.bind.RelaxedDataBinderTests.TargetWithNestedObject) BeanWrapperImpl(org.springframework.beans.BeanWrapperImpl) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 BeanWrapperImpl (org.springframework.beans.BeanWrapperImpl)1 TargetWithNestedObject (org.springframework.boot.bind.RelaxedDataBinderTests.TargetWithNestedObject)1