use of org.apache.sling.models.testmodels.classes.implextend.EvenSimplerPropertyModel in project sling by apache.
the class ImplementsExtendsTest method testExtendsClassModel.
/**
* Test to adapt to a superclass of the implementation class with the appropriate mapping in the @Model annotation.
*/
@Test
public void testExtendsClassModel() {
Resource res = getMockResourceWithProps();
// this is not having a model annotation nor does implement an interface/extend a class with a model annotation
SimplePropertyModel model = factory.getAdapter(res, SimplePropertyModel.class);
assertNotNull(model);
assertEquals("!first-value|null|third-value!", model.getAllProperties());
assertTrue(factory.canCreateFromAdaptable(res, SimplePropertyModel.class));
EvenSimplerPropertyModel simplerModel = factory.getAdapter(res, EvenSimplerPropertyModel.class);
assertNotNull(simplerModel);
assertEquals("first-value", model.getFirst());
assertTrue(factory.canCreateFromAdaptable(res, EvenSimplerPropertyModel.class));
}
Aggregations