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);
}