How to mock
@source(“script-bindings”)
Page currentPage;
and
@source("script-bindings")
private ValueMap pageProperties;
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @kanikaa32870678 ,
If you're using AEMContext, it would be pretty straight forward. Try this:
Page page = context.currentPage(CONTAINING_PAGE); slingBindings = (SlingBindings) context.request().getAttribute(SlingBindings.class.getName());
You can mock value map similarly.
AemContext : https://wcm.io/testing/aem-mock/junit5/apidocs/io/wcm/testing/mock/aem/junit5/AemContext.html
Hi @kanikaa32870678 ,
If you're using AEMContext, it would be pretty straight forward. Try this:
Page page = context.currentPage(CONTAINING_PAGE); slingBindings = (SlingBindings) context.request().getAttribute(SlingBindings.class.getName());
You can mock value map similarly.
AemContext : https://wcm.io/testing/aem-mock/junit5/apidocs/io/wcm/testing/mock/aem/junit5/AemContext.html
Views
Replies
Total Likes
That's fine, what you need to do is, when you create test class for sling modal, use AemContext and get the injected properties through the way described above
Views
Replies
Total Likes
Views
Replies
Total Likes
Did you find a way to get the pageProperties working? I'm not able to get anything but null. I verified and i'm adding a proper valuemap in the sling bindings object but still not picking it
Views
Replies
Total Likes
Views
Like
Replies
Views
Likes
Replies