use of org.apache.sling.models.testmodels.interfaces.PropertyModelWithDefaults in project sling by apache.
the class DefaultTest method testDefaultStringValueOnInterfaceField.
@Test
public void testDefaultStringValueOnInterfaceField() {
ValueMap vm = new ValueMapDecorator(Collections.<String, Object>singletonMap("first", "first value"));
Resource res = mock(Resource.class);
when(res.adaptTo(ValueMap.class)).thenReturn(vm);
PropertyModelWithDefaults model = factory.getAdapter(res, PropertyModelWithDefaults.class);
assertNotNull(model);
assertEquals("first value", model.getFirst());
assertEquals("second default", model.getSecond());
}
Aggregations