@Test
public void testChildModel() {
Object value = RandomStringUtils.randomAlphabetic(10);
Map<String, Object> props = Collections.singletonMap("property", value);
ValueMap map = new ValueMapDecorator(props);
final Resource firstChild = mock(Resource.class);
when(firstChild.adaptTo(ValueMap.class)).thenReturn(map);
when(firstChild.adaptTo(ChildModel.class)).thenAnswer(new AdaptToChildModel());
Object firstGrandChildValue = RandomStringUtils.randomAlphabetic(10);
ValueMap firstGrandChildMap = new ValueMapDecorator(Collections.singletonMap("property", firstGrandChildValue));
Object secondGrandChildValue = RandomStringUtils.randomAlphabetic(10);
ValueMap secondGrandChildMap = new ValueMapDecorator(Collections.singletonMap("property", secondGrandChildValue));
final Resource firstGrandChild = mock(Resource.class);
when(firstGrandChild.adaptTo(ValueMap.class)).thenReturn(firstGrandChildMap);
when(firstGrandChild.adaptTo(ChildModel.class)).thenAnswer(new AdaptToChildModel());