これまでは、パッケージ名やクラス名によっては、特定のクラスを除外しています。カバレッジから以下のような列挙型を除外できる方法はありますか?コードカバレッジからenumクラスを除外しますか?
package com.*;
public enum Quality {
high,normal,low;
}
対象範囲私は、JUnitとJMockitでmaven-surefire-pluginを使用しています。そして、私のカバレッジ設定は次のようになります
<build>
<plugins>
....
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit4</artifactId>
<version>2.18.1</version>
</dependency>
</dependencies>
<configuration>
<systemPropertyVariables>
<coverage-excludes>com.test.*,*IT.java</coverage-excludes>
</systemPropertyVariables>
</configuration>
</plugin>
....
</build>
<dependencies>
....
<dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit</artifactId>
<version>1.17</version>
</dependency>
<dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit-coverage</artifactId>
<version>1.17</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
....
</dependencies>
なぜ列挙型を除外しますか?あなたのプロダクションコードのいくつかがこれらの列挙型を使用している場合は、必ずそれらがカバーされます。そうでなければ、特定の値が使用されていないことを示します。 – GauravJ