Skip to content

Improve test coverage, fix bugs, and update JaCoCo/CI - #33

Merged
LeonardoBai12 merged 9 commits into
mainfrom
lbai/feat/pm-mapper-tests
Jun 22, 2026
Merged

LeonardoBai12 merged 9 commits into
mainfrom
lbai/feat/pm-mapper-tests

Conversation

@LeonardoBai12

Copy link
Copy Markdown
Owner

Summary

  • Mapper: Added 8+ new test scenarios to MapperServiceImplTest (Double/Boolean types, root-level fields, nested parents, concatenation with empty values, null String omission); fixed null String bug in MapperServiceImpl where JsonNull.content returned "null" instead of being filtered
  • Server/Client: Added test scenarios for multi-header forwarding, auth isolation, HTTP method mapping, fallback behavior; fixed Head → Put bug in ClientExtensions; fixed Middleware's own Authorization header leaking into external API calls (filtered in both ServerServiceImpl and ClientExtensions)
  • JaCoCo: Fixed three bugs in ProjectExtensions.kt — DirectoryProperty path resolution, wrong Android class paths for JVM modules, setFrom replacing instead of accumulating across modules; coverage now runs across all modules (51% instructions overall)
  • CI: Fixed jacocoProjectMiddleWareCoverageVerification task name typo and wrong artifact path in coverage workflow
  • Docs: Documented authHeader in originalRoute for external API authentication in MappingRequest.md; added CLAUDE.md to .gitignore

Test plan

  • Run ./gradlew test — all tests should pass
  • Run ./gradlew jacocoProjectMiddlewareCoverageVerification — coverage thresholds should be met
  • Run ./gradlew detekt — no style violations
  • Verify CI coverage workflow runs correctly on the PR

🤖 Generated with Claude Code

LeonardoBai12 and others added 4 commits June 22, 2026 01:44
Expand MapperServiceImplTest with new scenarios covering Double/Boolean
type mapping, root-level fields without parents, non-200 status code
preservation, multiple parent levels, null String omission with
ignoreEmptyValues, and concatenated fields with empty values.

Add supporting helpers to RegularHelper, ConcatenatedHelper, and
HelperWithoutEmptyValues (ignoreEmptyValues param on
getConcatenatedMappingRule, expectedMeasuredResponseWithEmptyValues,
flat/deep-nested response factories).

Fix MapperServiceImpl.transformValue: the String branch was calling
.jsonPrimitive.content on JsonNull, producing the literal string "null"
instead of JsonNull, bypassing the null-filter in mapOldResponse.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fix ClientExtensions.getHttpMethod: Head was incorrectly mapped to Put.

Fix auth header isolation: ServerServiceImpl now filters Authorization
from captured request headers so the Middleware's own JWT/Basic auth
is never forwarded to the external API. ClientExtensions skips
Authorization when iterating headers so OriginalRoute.authHeader always
takes priority over any Authorization value in preConfiguredHeaders.

Expand ClientServiceImplTest with 8 new scenarios: Bearer/Basic/null
auth header forwarding, Head HTTP method verification, empty
preConfiguredHeaders/Queries/Body fallback to originalRoute values,
and authHeader priority over conflicting headers.

Expand ServerServiceImplTest with 6 new scenarios: unauthorized
request returns 401, multiple custom headers forwarded, Authorization
not forwarded to handler, MiddlewareException and
IllegalArgumentException handling on mapping/routes routes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Fixed three bugs in ProjectExtensions.kt: DirectoryProperty path resolution,
  wrong Android class paths used for JVM modules, and setFrom replacing instead
  of accumulating coverage across modules
- Documented external API authHeader in MappingRequest.md, clarifying isolation
  from the Middleware's own Authorization header
- Added CLAUDE.md to .gitignore

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- jacocoProjectMiddleWareCoverageVerification → jacocoProjectMiddlewareCoverageVerification (case fix)
- Updated failure artifact path to match actual JaCoCo report output directory

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@LeonardoBai12 LeonardoBai12 self-assigned this Jun 22, 2026
LeonardoBai12 and others added 5 commits June 22, 2026 02:28
- Moved HttpHeaders import into lexicographic position in ServerServiceImpl.kt
- Removed unused assertNull import from ServerServiceImplTest.kt

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
setJacocoJvmDirectories was missing model, di, plugins, session, security,
and internal exclusions that setJacocoDirectories already had, causing those
packages to appear in the multi-module report after the path fix landed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ation

Replaces the hardcoded 0.80 default in setupCoverageVerification with a
minimumCoverage property read from gradle.properties via rootProject.
Set to 0.60 to match current multi-module instruction coverage.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@LeonardoBai12
LeonardoBai12 merged commit a2fdab8 into main Jun 22, 2026
2 checks passed
@LeonardoBai12
LeonardoBai12 deleted the lbai/feat/pm-mapper-tests branch June 22, 2026 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant