到目前为止,我根据包名或类名排除某些类。有什么办法可以排除下面给出的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