Search in sources :

Example 1 with DefaultStringModel

use of org.apache.sling.models.testmodels.classes.DefaultStringModel in project sling by apache.

the class DefaultTest method testDefaultStringValueField.

@Test
public void testDefaultStringValueField() {
    ValueMap vm = new ValueMapDecorator(Collections.<String, Object>emptyMap());
    Resource res = mock(Resource.class);
    when(res.adaptTo(ValueMap.class)).thenReturn(vm);
    DefaultStringModel model = factory.getAdapter(res, DefaultStringModel.class);
    assertNotNull(model);
    assertEquals("firstDefault", model.getFirstProperty());
    assertEquals(2, model.getSecondProperty().length);
}
Also used : ValueMap(org.apache.sling.api.resource.ValueMap) ValueMapDecorator(org.apache.sling.api.wrappers.ValueMapDecorator) Resource(org.apache.sling.api.resource.Resource) DefaultStringModel(org.apache.sling.models.testmodels.classes.DefaultStringModel) Test(org.junit.Test)

Aggregations

Resource (org.apache.sling.api.resource.Resource)1 ValueMap (org.apache.sling.api.resource.ValueMap)1 ValueMapDecorator (org.apache.sling.api.wrappers.ValueMapDecorator)1 DefaultStringModel (org.apache.sling.models.testmodels.classes.DefaultStringModel)1 Test (org.junit.Test)1