ValueMap vm = spy(new ValueMapDecorator(map));
Resource res = mock(Resource.class);
when(res.adaptTo(ValueMap.class)).thenReturn(vm);
ResourceModelWithRequiredFieldOptionalStrategy model = factory.getAdapter(res, ResourceModelWithRequiredFieldOptionalStrategy.class);
assertNull(model);
verify(vm).get("optional", String.class);
verify(vm).get("required", String.class);
}