0

I am facing one issue. My java bean has specific annotations to the bean. For example:

@JcrProperty(name = "vermittlernummer")
private String vermittlernummer;

These annotations are included in code coverage when I run the build. So, it is impacting over all code coverage. I need to exclude the variable declaration annotations in Sonar cobertura code coverage.

How can we exclude variable annotation in code coverage.

Thanks.

Jens
  • 20,533
  • 11
  • 60
  • 86
  • I'd imagine that with "Java Bean" you mean Sling Models. In this case you might consider constructor based injection over field injection. That would make testing a lot easier and help you with your code coverage. See https://sling.apache.org/documentation/bundles/models.html#basic-usage – Jens Mar 18 '18 at 13:10
  • Thanks for the response. it is not Sling model. It is simple java bean with annotations. We are using it for create,get and update node based on Json. I think there is way to exclude variable declaration in code coverage. – Prasad Boggavarapu Mar 19 '18 at 08:42
  • Did you see this related question here: https://stackoverflow.com/questions/10971968/turning-sonar-off-for-certain-code ? – ronnyfm Mar 19 '18 at 15:30

0 Answers0