到目前爲止,我根據包名或類名排除某些類。有什麼辦法可以排除下面給出的Enums嗎?從代碼覆蓋範圍中排除枚舉類?
package com.*;
public enum Quality {
high,normal,low;
}
覆蓋範圍我使用maven-surefire插件與JUnit和JMockit。而我的報道的設置是這樣
<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