|
37 | 37 | <artifactId>jsqlparser</artifactId> |
38 | 38 | <version>5.3</version> |
39 | 39 | </dependency> |
| 40 | + <!-- JUnit 5 --> |
40 | 41 | <dependency> |
41 | | - <groupId>junit</groupId> |
42 | | - <artifactId>junit</artifactId> |
| 42 | + <groupId>org.junit.jupiter</groupId> |
| 43 | + <artifactId>junit-jupiter</artifactId> |
43 | 44 | <scope>test</scope> |
44 | 45 | </dependency> |
| 46 | + |
| 47 | + <!-- Mockito for JUnit 5 --> |
| 48 | + <dependency> |
| 49 | + <groupId>org.mockito</groupId> |
| 50 | + <artifactId>mockito-core</artifactId> |
| 51 | + <scope>test</scope> |
| 52 | + </dependency> |
| 53 | + <dependency> |
| 54 | + <groupId>org.mockito</groupId> |
| 55 | + <artifactId>mockito-junit-jupiter</artifactId> |
| 56 | + <scope>test</scope> |
| 57 | + </dependency> |
| 58 | + |
| 59 | + <!-- Spring Boot Test --> |
| 60 | + <dependency> |
| 61 | + <groupId>org.springframework.boot</groupId> |
| 62 | + <artifactId>spring-boot-starter-test</artifactId> |
| 63 | + <scope>test</scope> |
| 64 | + <exclusions> |
| 65 | + <exclusion> |
| 66 | + <groupId>org.junit.vintage</groupId> |
| 67 | + <artifactId>junit-vintage-engine</artifactId> |
| 68 | + </exclusion> |
| 69 | + </exclusions> |
| 70 | + </dependency> |
45 | 71 |
|
46 | 72 | <dependency> |
47 | 73 | <groupId>org.springframework.boot</groupId> |
|
163 | 189 | <groupId>org.springframework.boot</groupId> |
164 | 190 | <artifactId>spring-boot-maven-plugin</artifactId> |
165 | 191 | </plugin> |
| 192 | + |
| 193 | + <!-- Maven Surefire Plugin for JUnit 5 --> |
| 194 | + <plugin> |
| 195 | + <groupId>org.apache.maven.plugins</groupId> |
| 196 | + <artifactId>maven-surefire-plugin</artifactId> |
| 197 | + <version>3.5.2</version> |
| 198 | + <configuration> |
| 199 | + <useSystemClassLoader>false</useSystemClassLoader> |
| 200 | + <includes> |
| 201 | + <include>**/*Test.java</include> |
| 202 | + <include>**/*Tests.java</include> |
| 203 | + </includes> |
| 204 | + </configuration> |
| 205 | + </plugin> |
| 206 | + |
| 207 | + <!-- JaCoCo Maven Plugin for Code Coverage --> |
| 208 | + <plugin> |
| 209 | + <groupId>org.jacoco</groupId> |
| 210 | + <artifactId>jacoco-maven-plugin</artifactId> |
| 211 | + <version>0.8.11</version> |
| 212 | + <executions> |
| 213 | + <!-- 准备JaCoCo代理,用于收集覆盖率数据 --> |
| 214 | + <execution> |
| 215 | + <id>prepare-agent</id> |
| 216 | + <goals> |
| 217 | + <goal>prepare-agent</goal> |
| 218 | + </goals> |
| 219 | + </execution> |
| 220 | + |
| 221 | + <!-- 生成覆盖率报告 --> |
| 222 | + <execution> |
| 223 | + <id>report</id> |
| 224 | + <phase>test</phase> |
| 225 | + <goals> |
| 226 | + <goal>report</goal> |
| 227 | + </goals> |
| 228 | + </execution> |
| 229 | + |
| 230 | + <!-- 检查覆盖率阈值 --> |
| 231 | + <execution> |
| 232 | + <id>check</id> |
| 233 | + <goals> |
| 234 | + <goal>check</goal> |
| 235 | + </goals> |
| 236 | + <configuration> |
| 237 | + <rules> |
| 238 | + <rule> |
| 239 | + <element>BUNDLE</element> |
| 240 | + <limits> |
| 241 | + <!-- 指令覆盖率最低要求 --> |
| 242 | + <limit> |
| 243 | + <counter>INSTRUCTION</counter> |
| 244 | + <value>COVEREDRATIO</value> |
| 245 | + <minimum>0.00</minimum> |
| 246 | + </limit> |
| 247 | + <!-- 分支覆盖率最低要求 --> |
| 248 | + <limit> |
| 249 | + <counter>BRANCH</counter> |
| 250 | + <value>COVEREDRATIO</value> |
| 251 | + <minimum>0.00</minimum> |
| 252 | + </limit> |
| 253 | + <!-- 类覆盖率最低要求 --> |
| 254 | + <limit> |
| 255 | + <counter>CLASS</counter> |
| 256 | + <value>COVEREDRATIO</value> |
| 257 | + <minimum>0.00</minimum> |
| 258 | + </limit> |
| 259 | + <!-- 方法覆盖率最低要求 --> |
| 260 | + <limit> |
| 261 | + <counter>METHOD</counter> |
| 262 | + <value>COVEREDRATIO</value> |
| 263 | + <minimum>0.00</minimum> |
| 264 | + </limit> |
| 265 | + <!-- 行覆盖率最低要求 --> |
| 266 | + <limit> |
| 267 | + <counter>LINE</counter> |
| 268 | + <value>COVEREDRATIO</value> |
| 269 | + <minimum>0.00</minimum> |
| 270 | + </limit> |
| 271 | + </limits> |
| 272 | + </rule> |
| 273 | + </rules> |
| 274 | + </configuration> |
| 275 | + </execution> |
| 276 | + </executions> |
| 277 | + <configuration> |
| 278 | + <!-- 排除不需要生成覆盖率报告的类 --> |
| 279 | + <excludes> |
| 280 | + <exclude>**/Application.class</exclude> |
| 281 | + <exclude>**/config/**</exclude> |
| 282 | + <exclude>**/dto/**</exclude> |
| 283 | + <exclude>**/vo/**</exclude> |
| 284 | + <exclude>**/entity/**</exclude> |
| 285 | + <exclude>**/util/exception/**</exclude> |
| 286 | + </excludes> |
| 287 | + </configuration> |
| 288 | + </plugin> |
166 | 289 | </plugins> |
167 | 290 | </build> |
168 | 291 |
|
|
0 commit comments