How can I exclude methods (hashcode and equals) from the clover coverage report?

I would like to exclude hashCode, and equalsof clover report.
Some example configuration would be nice.

+5
source share
2 answers

You have to take two steps:

1) Define method contexts in the <clover-setup> task containing regular expressions for the methods you want to map, for example:

<clover-setup ...>
    <methodContext name="equals" regexp="public boolean equals\(.*\)"/>
    <methodContext name="hashCode" regexp="public int hashCode\(\)"/>
</clover-setup>

2) Determine which method contexts should be excluded from the report in <clover-report> Task

<clover-report>
   <current outfile="clover_html" title="My Coverage">
     <format type="html" filter="equals,hashCode"/>
   </current>

Additional Information:

+1
source

I would like to exclude hashCode and is equal from the clover report.

, , . , . NPE hashCode equals. , :

unit test hashCode ?

LocalEqualsHashCodeTest, unit test:

http://pastebin.com/L03fHAjv

createInstance(), createNotEqualInstance(), , .

+3

All Articles