Hehe...this turned out to be a false alarm.

I had looked at the MockResource code and thought that it was the reason null 
was coming back, but I looked a little further and found an issue in my code 
that was causing the problem.  The Sling mock context with the default resource 
resolver is working fine now.

________________________________
From: John Logan <john.lo...@texture.com>
Sent: Friday, April 7, 2017 3:29:33 PM
To: users@sling.apache.org
Subject: Unit testing code that sets properties using ModifiableValueMap?

Hi,

I'm writing some unit tests for my code and am trying to use Sling Mocks [1].

My code sets properties using resource.adaptTo(ModifiableValueMap.class), but 
when used with a MockResource, the call returns null, failing the test.  Is 
there a recommended way to code unit tests for such cases?

Thanks!  John

[1] https://sling.apache.org/documentation/development/sling-mock.html

Reply via email to