Quickie: how to make Clover ignore private constructors in Eclipse

PDF

Here’s a blatant repost of How to make Clover ignore private constructors by Alex Ruiz.

I was actually looking for a regular expression matching private constructors so that I could make Clover ignore these in the Eclipse plugin. His post is about how to configure Clover in Maven however, here’s how you configure the Eclipse plugin.

First the regular expression:

Now to add this to Eclipse, unfortunately you need to configure the Clover settings on a project basis. Go to your project rightclick -> Clover -> Configure…. Then click Add under Custom Coverage Context Filters and fill in the form as seen below.

Clover configured to exclude private constructors

Hit OK and rebuild and test your project and voilà, your constructor is ignored.

Tags:

Leave a Reply