@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(); }
@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"); assertNotNull(wrapper.getPropertyValue("nested")); }