


Hi Team,
I have written jUnit test cases for custom teaser component which extends the core Teaser component using the Delegation Pattern for Sling Models using "@Self @Via(type=ResourceSuperType.class) as specified here: https://github.com/adobe/aem-core-wcm-components/wiki/Delegation-Pattern-for-Sling-Models
Junit coverage is less on environment, in my local it is 100 % I have covered junits for custom methods which written custom teaser model, There are methods in parent class ( below in screenshot ) which does not cover in my custom test class, How to overcome this issue?
Solved! Go to Solution.
Views
Replies
Total Likes
@gskittu Have a getter method which returns Teaser teaser which you have injected @Self and @Via
Just showing an example below you can follow the same pattern while dealing with any delegate slingmodels
Example.class
ExampleTest.java
Hope this helps,
Krishna
@gskittu Have a getter method which returns Teaser teaser which you have injected @Self and @Via
Just showing an example below you can follow the same pattern while dealing with any delegate slingmodels
Example.class
ExampleTest.java
Hope this helps,
Krishna
Thanks you Krishna, There are some more methods which we don't require, With those fields coverage is less, how can we fix this issue
@gskittu you can do check for asserNull for methods which you are not using