I am having trouble with getting an AEM specific service from inside a unit test class.
I have tried using the context.getService() method as well as using the service reference with the bundle context.
I'd like to get Externalizer and inject it into the xlass I am testing, however it always resolves as null:
Code:
Externalizer service = context.getService(Externalizer.class);
Or code:
ServiceReference ref = context.bundleContext().getServiceReference(Externalizer.class.getName());
Externalizer service2 = (Externalizer) context.bundleContext().getService(ref);
Am I doing something wrong or misunderstanding the steps to retrieve an OSGI service?
Cheers,
Alex
I see, I thought it might be the case, I wanted to be sure.
Cheers,
Alex