test: enforce 100% coverage gate on pure-logic core classes#11
Merged
Conversation
added 3 commits
July 9, 2026 11:50
Establish a CORE set of pure-logic classes with a JaCoCo check execution (check-core) that enforces 100% line and branch coverage, failing the build if coverage drops. The core set includes: PlayerDirectionUtil, ColorUtil, Piece, SetType, and SetDataType. - Extend PlayerDirectionUtil tests to cover all 8 direction octants with boundary values, negative yaw normalization, and large yaw wrap - Simplify PlayerDirectionUtil's else-if chain to remove redundant upper-bound conditions (semantically equivalent, eliminates unreachable bytecode branches) - Add ColorUtil tests covering color code translation, edge cases - Add Piece, SetType, SetDataType enum tests for full coverage - Exclude LogUtil (server-dependent) and nbt.NBTType (vendored) from the gate with justification in AGENTS.md
- S2699: add assertion to ColorUtil constructor test - S5976: consolidate repeated direction tests into parameterized tests (south, west, north, east octants each had 3-4 nearly-identical tests) - S1128: remove unused ParameterizedTest/CsvSource imports (now used)
… new 100% core-class gate
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Intent
Fix all 6 SonarCloud issues on PR #11: S2699 (add assertion to constructor test), S5976 x3 (consolidate repeated tests into parameterized tests for south, west, east octants), S1128 x2 (unused imports now used by the parameterized tests). No logic changes, same 100% core coverage gate passes, same test coverage. The refactoring reduces test LOC by consolidating 31 individual test methods into 9 parameterized test methods that still exercise the same yaw values and direction assertions.
What Changed
check-coreexecution inpom.xmlthat fails the build if line or branch coverage drops below 100% on the five pure-logic core classes (PlayerDirectionUtil,ColorUtil,Piece,SetType,SetDataType).ColorUtil,Piece,SetType, andSetDataType, and refactoredPlayerDirectionUtilTestfrom 31 individual test methods into 9 parameterized tests covering all 8 compass octants plus yaw normalization - resolving SonarCloud S5976, S1128, and S2699 issues.PlayerDirectionUtil's if-else chain (semantically equivalent since the else-if structure already guarantees bounds).Risk Assessment
✅ Low: The production code change is a mechanical simplification of redundant conditions in an if-else-if chain with identical runtime behavior, and all other changes are test-only or build-config additions that do not affect shipped code.
Testing
Ran the full Maven verify lifecycle under JDK 25. All 43 tests pass and the JaCoCo check-core gate confirms 100% line and branch coverage on the five core classes. The parameterized test refactoring exercises the same 31 yaw-to-direction combinations as before, just consolidated into fewer methods.
Evidence: Maven verify summary (test counts + coverage gate)
[INFO] Tests run: 31, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.126 s -- in gg.steve.mc.ap.utils.PlayerDirectionUtilTest [INFO] Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.018 s -- in gg.steve.mc.ap.utils.ColorUtilTest [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 s -- in gg.steve.mc.ap.armor.SetTypeTest [INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 s -- in gg.steve.mc.ap.armor.PieceTest [INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 s -- in gg.steve.mc.ap.data.SetDataTypeTest [INFO] Tests run: 43, Failures: 0, Errors: 0, Skipped: 0 [INFO] --- jacoco:0.8.15:check (check-core) @ ArmorPlus --- [INFO] BUILD SUCCESSEvidence: JaCoCo CSV - core class coverage (all 0 missed)
GROUP,PACKAGE,CLASS,INSTRUCTION_MISSED,INSTRUCTION_COVERED,BRANCH_MISSED,BRANCH_COVERED,LINE_MISSED,LINE_COVERED ArmorPlus,gg.steve.mc.ap.utils,ColorUtil,0,7,0,0,0,2 ArmorPlus,gg.steve.mc.ap.utils,PlayerDirectionUtil,0,104,0,18,0,27 ArmorPlus,gg.steve.mc.ap.data,SetDataType,0,75,0,0,0,13 ArmorPlus,gg.steve.mc.ap.armor,Piece,0,33,0,0,0,6 ArmorPlus,gg.steve.mc.ap.armor,SetType,0,3,0,0,0,1Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
mvn -B clean verify (full lifecycle: compile, test, JaCoCo instrument/report/check-core)Verified PlayerDirectionUtilTest runs 31 parameterized cases covering all 8 compass octants plus large-yaw normalizationConfirmed JaCoCo CSV shows 0 missed instructions/branches/lines for all 5 core classes (PlayerDirectionUtil, ColorUtil, Piece, SetType, SetDataType)Verified unused import removed (S1128) and parameterized imports are exercised (S5976)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.