Skip to content

DEV-326: migrate Posix tests from JUnit 4 to JUnit 5#88

Open
tgd wants to merge 3 commits intodevelopfrom
feature/DEV-326-junit-4-to-5
Open

DEV-326: migrate Posix tests from JUnit 4 to JUnit 5#88
tgd wants to merge 3 commits intodevelopfrom
feature/DEV-326-junit-4-to-5

Conversation

@tgd
Copy link
Copy Markdown
Contributor

@tgd tgd commented Apr 19, 2026

Summary

  • Mechanical migration of all JUnit 4 test code in src/test/java to JUnit 5 Jupiter.
  • POM change: swap junit:junit for junit-jupiter (versions inherited from java-parent-pom).

Bulk-change context

Part of a coordinated cross-repo JUnit 4 → JUnit 5 migration tracked by Epic DEV-324.

Sibling PRs (in this batch):

Acceptance criteria

  • mvn clean install passes locally
  • Test count preserved vs. baseline (12 → 12)
  • Diff limited to JUnit migration edits (no drive-by reformatting)
  • Latency-aware code review passes 1 & 2 clean (test code only, no production changes)
  • CI (TeamCity) green on all supported platforms (see note below)

JaCoCo is not configured in this repo, so the coverage gate is N/A.

What changed mechanically

  • org.junit.Testorg.junit.jupiter.api.Test
  • org.junit.Assert.*org.junit.jupiter.api.Assertions.*
  • org.junit.Assume.assumeTrue / assumeFalseorg.junit.jupiter.api.Assumptions.*
  • assumeTrue/assumeFalse(msg, bool)(bool, msg) (JUnit 5 message-last convention)

Three test-tree files touched: JNRPosixAPITest (the actual tests) plus BenchmarkMain / MSyncFileBenchmarkMain — non-test helper main() classes that use JUnit assertions and needed consistent import changes.

No production source changed.

Jira

DEV-326 — part of Epic DEV-324.

Fixes DEV-326.

🤖 Generated with Claude Code

CI note: ARM build red (pre-existing, out of scope)

The Snapshot Linux ARM configuration fails because of JNRPosixAPITest.mlock2 — the ARM kernel on the TeamCity agent returns ENOSYS for the mlock2 syscall, and the test has no assumeTrue guard for kernel-feature availability.

Evidence this is not caused by this PR:

  • The failing test body (JNRPosixAPITest.mlock2, lines ~130-150) is byte-identical between origin/develop and this branch.
  • ARM builds #136–#138 on unrelated sausage/docs-* doc-only branches (1 day prior) fail in the same ~11 seconds with the same error.
  • All other CI configurations pass: Linux Java 8/11/17/21, Mac, Windows, Zing 8/11.

Suggested follow-up (separate ticket): add assumeTrue(jnr.has_mlock2()) or equivalent kernel-capability guard to JNRPosixAPITest.mlock2.

tgd added 3 commits April 19, 2026 20:41
Keep Vintage on the classpath so existing JUnit 4 tests continue to run
while source is migrated to Jupiter. Versions come from the parent
java-parent-pom.
Mechanical migration via OpenRewrite's JUnit4to5Migration recipe:

- org.junit.Test -> org.junit.jupiter.api.Test
- org.junit.Assert.* -> org.junit.jupiter.api.Assertions.*
- org.junit.Assume.* -> org.junit.jupiter.api.Assumptions.*
- assumeTrue/assumeFalse(msg, bool) -> (bool, msg)

Touches JNRPosixAPITest.java plus two BenchmarkMain helper classes
that had assertEquals imports. All 12 tests still pass; no
behavioural changes. Dropping junit-vintage-engine now that no
JUnit 4 source remains.
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.

2 participants