use of org.apache.sling.models.testmodels.classes.ChildResourceViaModel in project sling by apache.
the class ViaTest method testProjectionToChildResource.
@Test
public void testProjectionToChildResource() {
String value = RandomStringUtils.randomAlphanumeric(10);
ValueMap map = new ValueMapDecorator(Collections.<String, Object>singletonMap("firstProperty", value));
when(childResource.adaptTo(ValueMap.class)).thenReturn(map);
ChildResourceViaModel model = factory.getAdapter(resource, ChildResourceViaModel.class);
assertNotNull(model);
assertEquals(value, model.getFirstProperty());
}
Aggregations