


Dear Members,
I came across with above problem while debugging some junit test cases for sling model.
Exctract:
"Let say your sling model is adaptables to sling Resource and in your test class you are trying to get the instance of your respective Object by adapting request of aemContext. In this case you will end up with NullPointerException."
Details are below:
https://aemhelper.blogspot.com/2022/03/common-cause-of-nullpionterexception-or.html
Please provide your feedback, if any to make it more helpful.
Thanks
Umesh Thakur
Views
Replies
Sign in to like this content
Total Likes
You can add, addModelsForPackage, as this is another common null returned from adapt.
aemContext.addModelsForPackage("com.sourcedcode.core.models.utils");