You can use Sling Mocks and wcm.io for writing your Mocks. There is a good article by Jorg on SlingContext which is really helpful in writing and testing AEM Mocks. Please check the same here
There are additional article from him which help you to work with Sling Mocks
Part 1 - https://cqdump.wordpress.com/2019/01/09/writing-unit-tests-for-aem-using-slingmocks/
Part -2 - https://cqdump.wordpress.com/2019/01/14/writing-unit-tests-for-aem-part-2-maven-setup/
Part 3- https://cqdump.wordpress.com/2019/01/17/writing-unittests-for-aem-part-3-mocking-resources/
Hope this helps. There are quite a few articles on the same out there.