Add JaCoCo branch coverage gate (80% minimum) to Maven build #120
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The backend build has no coverage measurement. There is no JaCoCo plugin configured, no coverage report generated, and the CI pipeline never reports a coverage number. The 80% branch coverage floor we aim for is completely unenforced — we don't even know what the current coverage is.
Why This Matters
Line coverage is a vanity metric. Branch coverage tells you whether your tests actually exercise decision points — the
if/else, theswitch, theOptional.orElseThrow. Without measuring it, we have no signal when a new service method ships with zero test coverage. A missed branch on an error path is exactly where production bugs hide.What Needs To Be Done
pom.xml:./mvnw verifyto get the current coverage baseline@Configurationclasses)Acceptance Criteria
./mvnw verifyfails if branch coverage drops below 80%Architect review (@mkeller): ⚠️ The JaCoCo config is correct, but the sequencing matters.
Do #119 (Testcontainers + real PostgreSQL) before adding this gate. If you add an 80% branch coverage floor today against the current mock-heavy test suite, you will either discover the gate immediately fails and disable it in frustration, or you'll find coverage appears artificially high because barely-touched service methods don't contribute meaningful branches. Neither gives useful signal.
Right sequence:
./mvnw verifyto get the actual measured baselineThe acceptance criterion "Current coverage is ≥ 80% (or a plan exists to close the gap)" is a bit circular — you need to measure before you can know whether a plan is needed.
Baseline measured: 46.8% branch coverage (265/566 branches covered, excluding DTOs, config classes, model entities, and ErrorCode enum).
Initial gate set at 42% (baseline − 5%) to prevent regression without blocking CI.
Gap to target: 46.8% → 80% = 33.2 percentage points. The main coverage gaps are service error paths (DomainException branches in DocumentService, PersonService, UserService) and the security/permission layer. Each new service test that covers an error path will close this gap.