---
name: springboot-verification
description: >
Load when running the Spring Boot quality pipeline — mvn test, JaCoCo coverage reporting
(jacoco:report, jacoco:check with minimumRatio), Checkstyle or SpotBugs static analysis,
OWASP dependency-check:check, Spring Cloud Contract verifier, or configuring GitHub Actions
CI workflow to enforce quality gates (coverage threshold, zero-CVE policy) on pull requests.
---
# Spring Boot Verification
## Verification Pipeline — Ordered Gates
```
Gate 1: Compile
↓ (fail → stop)
Gate 2: Unit Tests
↓ (fail → stop)
Gate 3: Integration Tests
↓ (fail → stop)
Gate 4: Contract Tests
↓ (fail → stop)
Gate 5: Coverage (JaCoCo — line ≥ 80%, branch ≥ 80%)
↓ (fail → stop)
Gate 6: Mutation Testing (PITest — score ≥ 70%)
↓ (fail → stop)
Gate 7: Security Scan (OWASP — no CVSS ≥ 7)
↓ (fail → stop)
Gate 8: All Gates Green → Ready to merge/deploy
```
**Rule:** Never skip a gate. Never run gate N+1 when gate N fails.
---
## Maven Commands
```bash
# Gate 1 — Compile
mvn compile -q
# Gate 2 — Unit Tests
mvn test -DfailIfNoTests=false
# Gate 3 — Integration Tests (Failsafe)
mvn failsafe:integration-test failsafe:verify
# Gate 4 — Contract Tests
mvn spring-cloud-contract:generateTests verify
# Gate 5 — Coverage
mvn verify -P coverage
# Gate 6 — Mutation Testing
mvn test-compile org.pitest:pitest-maven:mutationCoverage
# Gate 7 — Security Scan
mvn org.owasp:dependency-check-maven:check -DfailBuildOnCVSS=7
```
---
## JaCoCo Coverage Config
```xml
org.jacoco
jacoco-maven-plugin
0.8.11
prepare-agentprepare-agent
check
verify
check
BUNDLE
LINECOVEREDRATIO0.80
BRANCHCOVEREDRATIO0.80
**/config/**
**/dto/**
**/*Application.class
```
---
## PITest Mutation Testing Config
```xml
org.pitest
pitest-maven
1.15.3
com.example.domain.*
com.example.service.*
com.example.*Test
70
80
```
Apply only to business logic (`domain`, `service`). PITest is slow — run in a dedicated CI job.
---
## OWASP Dependency-Check Config
```xml
org.owasp
dependency-check-maven
9.0.9
7
dependency-check-suppression.xml
```
Suppression with expiry:
```xml
False positive: CVE does not affect our usage
CVE-2023-XXXXX
2024-12-31
```
---
## Failure Handling Protocol
When a gate fails:
1. Stop immediately — do not proceed to the next gate.
2. Capture: test name, error message, stack trace (first 20 lines).
3. Identify root cause: compile error, assertion failure, environment issue, or configuration problem.
4. Fix the root cause.
5. Re-run from the **failed gate only** (not from Gate 1).
6. After 3 failed attempts at the same gate → escalate to user.
---
## GitHub Actions Pipeline
```yaml
name: verification-pipeline
on: [push, pull_request]
jobs:
compile:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with: { java-version: '21', distribution: 'temurin' }
- run: mvn compile -q
unit-tests:
needs: compile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with: { java-version: '21', distribution: 'temurin' }
- run: mvn test
integration-tests:
needs: unit-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with: { java-version: '21', distribution: 'temurin' }
- run: mvn failsafe:integration-test failsafe:verify
security-scan:
needs: integration-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with: { java-version: '21', distribution: 'temurin' }
- run: mvn org.owasp:dependency-check-maven:check -DfailBuildOnCVSS=7
```