use of org.apache.sling.models.testmodels.classes.ResourceModelWithRequiredField in project sling by apache.
the class ResourceModelInterfacesTest method testRequiredPropertyModel.
@Test
public void testRequiredPropertyModel() {
Map<String, Object> map = new HashMap<String, Object>();
map.put("first", "first-value");
map.put("third", "third-value");
ValueMap vm = spy(new ValueMapDecorator(map));
Resource res = mock(Resource.class);
when(res.adaptTo(ValueMap.class)).thenReturn(vm);
ResourceModelWithRequiredField model = factory.getAdapter(res, ResourceModelWithRequiredField.class);
assertNull(model);
verify(vm).get("required", String.class);
}
use of org.apache.sling.models.testmodels.classes.ResourceModelWithRequiredField in project sling by apache.
the class ResourceModelClassesTest method testRequiredPropertyModel.
@Test
public void testRequiredPropertyModel() {
Map<String, Object> map = new HashMap<String, Object>();
map.put("first", "first-value");
map.put("third", "third-value");
ValueMap vm = spy(new ValueMapDecorator(map));
Resource res = mock(Resource.class);
when(res.adaptTo(ValueMap.class)).thenReturn(vm);
ResourceModelWithRequiredField model = factory.getAdapter(res, ResourceModelWithRequiredField.class);
assertNull(model);
verify(vm).get("required", String.class);
}
Aggregations