Solved
Junit for Optional.map()
I want to write Junit for
Optional.map(pageResource -> pageResource.adaptTo(Page.class))
.map(Page::getTemplate)
But I am unable to mock these.
I want to write Junit for
Optional.map(pageResource -> pageResource.adaptTo(Page.class))
.map(Page::getTemplate)
But I am unable to mock these.
@shaheena_sheikh , very simple, you would need to add mock resources in the AEMContext. In particular you would want to create pages like:
context.pageManager().create("/content/sample/page1", "page1",
"/apps/sample/templates/homepage", "page1");
And you would want to pass in resolver.resolve("/content/sample/page1");
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.