How can I write a unit test to test below Sling Query from my code.
List<Resource> legalDisclaimerResourceList = $(legalDisclaimerPageResource).find(LEGAL_DISCLAIMER).asList();
$ refers to Sling Query from
import static org.apache.sling.query.SlingQuery.$;
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @troubleshooter3,
Per the official Sling docs, Mock implementation for Sling Query is not available in the list of Selected Sling APIs (for which the mock is available)
https://sling.apache.org/documentation/development/sling-mock.html
Hi @troubleshooter3,
Per the official Sling docs, Mock implementation for Sling Query is not available in the list of Selected Sling APIs (for which the mock is available)
https://sling.apache.org/documentation/development/sling-mock.html
Hey
I am sharing new examples, just look into it , i hope you will find this helpful
For JUnit 5:
<dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.testing.sling-mock.junit5</artifactId> </dependency>
For JUnit 4:
<dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.testing.sling-mock.junit4</artifactId> </dependency>
Views
Replies
Total Likes