use of org.apache.sling.models.testmodels.classes.InjectorSpecificAnnotationModel in project sling by apache.
the class InjectorSpecificAnnotationTest method testSimpleValueModelField.
@Test
public void testSimpleValueModelField() {
Map<String, Object> map = new HashMap<String, Object>();
map.put("first", "first-value");
map.put("second", "second-value");
ValueMap vm = new ValueMapDecorator(map);
Resource res = mock(Resource.class);
when(res.adaptTo(ValueMap.class)).thenReturn(vm);
when(request.getResource()).thenReturn(res);
InjectorSpecificAnnotationModel model = factory.getAdapter(request, InjectorSpecificAnnotationModel.class);
assertNotNull("Could not instanciate model", model);
assertEquals("first-value", model.getFirst());
assertEquals("second-value", model.getSecond());
}
Aggregations