Skip to content

Add unit tests for PerLevelDataLoaderDispatchStrategy coverage#4308

Merged
andimarek merged 3 commits into
masterfrom
test/per-level-dispatch-strategy-coverage
Mar 8, 2026
Merged

Add unit tests for PerLevelDataLoaderDispatchStrategy coverage#4308
andimarek merged 3 commits into
masterfrom
test/per-level-dispatch-strategy-coverage

Conversation

@andimarek
Copy link
Copy Markdown
Member

Summary

  • Adds dedicated unit tests for PerLevelDataLoaderDispatchStrategy to deterministically cover concurrency-dependent code paths that are otherwise only hit under specific thread timing in integration tests.
  • Covers the markLevelAsDispatchedIfReady race condition (line 447), both exception handlers (executeObjectOnFieldValuesException, executionStrategyOnFieldValuesException), and concurrent onCompletionFinished dispatch.
  • Improves line coverage from 92.5% to 98.5%, branch coverage from 92.0% to 94.0%, and method coverage from 91.3% to 100.0%.

Test plan

  • All 4 new tests pass locally
  • Full test suite passes with ./gradlew test jacocoTestReport
  • JaCoCo coverage verified: only 2 lines remain uncovered (CAS retry loop body at L388, dead guard at L505)

🤖 Generated with Claude Code

Cover concurrency-dependent code paths that were previously only exercised
non-deterministically by integration tests, causing flaky coverage gate
failures in PRs:

- markLevelAsDispatchedIfReady: test the "another thread already dispatched"
  path (line 447) that requires two threads to race on dispatchedLevels.add()
- executeObjectOnFieldValuesException: error recovery path never triggered
  by integration tests
- executionStrategyOnFieldValuesException: same error recovery pattern at
  the root execution strategy level
- Concurrent onCompletionFinished race: two threads completing the same
  level simultaneously

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 8, 2026

Test Report

Test Results

Java Version Total Passed Failed Errors Skipped
Java 11 5684 (+4 🟢) 5628 (+4 🟢) 0 (±0) 0 (±0) 56 (±0)
Java 17 5684 (+4 🟢) 5627 (+4 🟢) 0 (±0) 0 (±0) 57 (±0)
Java 21 5684 (+4 🟢) 5627 (+4 🟢) 0 (±0) 0 (±0) 57 (±0)
Java 25 5684 (+4 🟢) 5627 (+4 🟢) 0 (±0) 0 (±0) 57 (±0)
jcstress 32 (±0) 32 (±0) 0 (±0) 0 (±0) 0 (±0)
Total 22768 (+16 🟢) 22541 (+16 🟢) 0 (±0) 0 (±0) 227 (±0)

Code Coverage (Java 25)

Metric Covered Missed Coverage vs Master
Lines 28706 3119 90.2% ±0.0%
Branches 8332 1510 84.7% ±0.0%
Methods 7683 1222 86.3% ±0.0%

Changed Class Coverage (1 class)

Class Line Branch Method
g.e.i.d.PerLevelDataLoaderDispatchStrategy +5.2% 🟢 ±0.0% +8.7% 🟢

Full HTML report: build artifact jacoco-html-report

Updated: 2026-03-08 23:18:19 UTC

andimarek and others added 2 commits March 9, 2026 08:46
Make CallStack, its fields, and markLevelAsDispatchedIfReady
package-private so tests can access them directly without reflection.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Convert JUnit test to Groovy/Spock to match project conventions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@andimarek andimarek merged commit 761df31 into master Mar 8, 2026
11 checks passed
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