you have to mock the service and after that you have to register the
service ex:-@MockMyAccountService myAccountService;@BeforeEachpublic
void setUp() throws Exception
{ctx.registerService(MyAccountService.class,
myAccountService);ctx.addModelsForClasses(test.class);testModel=ctx.request().adaptTo(test.class);follow
this document.https://wcm.io/testing/aem-mock/usage.html