I am trying to run server side unit testing as advised in the advance developer guide.
I am able to see my Test class under the URL" http://localhost:4502/system/sling/junit/tset.com.test.TestableClassTest.html "
when I execute the test case by clickling execute Tests, I get null pointer exception.
This is because repository is not getting injected, isnt that the purpose of server side testing so that we dont have to mock these osgi provided objects?
Please refer to the screenshot provided.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
Have you used the annotation "@TestReference" instead of the "@Reference" annotation in your unittests? Can you provide the sourcecode for your test class?
kind regards,
Jörg
Views
Replies
Total Likes
instead of using annotation @reference to inject the repository, use BundleContext and that should work. refer [1]
[1] bundleContext.getServiceReference(ResourceResolverFactory.class.getName());
Views
Replies
Total Likes
Hi,
Have you used the annotation "@TestReference" instead of the "@Reference" annotation in your unittests? Can you provide the sourcecode for your test class?
kind regards,
Jörg
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies