AEM Unit Test for servlet
I have to write a Unit Test for a servlet that uses
@Reference
private transient SearchService searchService;
When I run the doGetTest I get a NullPointerException since this searchService is null:
@Test
void doGetTest() throws IOException {
MockSlingHttpServletRequest request = context.request();
MockSlingHttpServletResponse response = context.response();
underTest.doGet(request, response);
How do I inject this SearchService in my Unit Test?
Thanks in advance.


