use of org.apache.sling.models.testmodels.interfaces.SimplePropertyModel in project sling by apache.
the class ResourceModelInterfacesTest method testSimplePropertyModel.
@Test
public void testSimplePropertyModel() {
Map<String, Object> map = new HashMap<String, Object>();
map.put("first", "first-value");
map.put("third", "third-value");
map.put("fourth", true);
ValueMap vm = new ValueMapDecorator(map);
Resource res = mock(Resource.class);
when(res.adaptTo(ValueMap.class)).thenReturn(vm);
SimplePropertyModel model = factory.getAdapter(res, SimplePropertyModel.class);
assertNotNull(model);
assertEquals("first-value", model.getFirst());
assertNull(model.getSecond());
assertEquals("third-value", model.getThirdProperty());
assertTrue(model.isFourth());
verify(res, times(1)).adaptTo(ValueMap.class);
}
Aggregations