Migrate Java tests from JUnit 4 to JUnit 5 Jupiter#35
Open
benfortuna wants to merge 2 commits into
Open
Conversation
The Java test suite was written in JUnit 4 style but the build runs with useJUnitPlatform() and only Jupiter on the test runtime classpath. With no vintage engine registered, JUnit Platform was silently skipping every JUnit 4 test class at discovery time, hiding most of the vCard property and parameter coverage. - Rewrite 67 test classes to use only org.junit.jupiter.api and org.junit.jupiter.params APIs - Reshape the PropertyTest / ParameterTest parameterized base classes as abstract @ParameterizedTest hosts; subclasses now supply only a static Stream<Arguments> parameters() method - Preserve the base classes' own parameter rows in new concrete subclasses ExtensionPropertyTest and ExtensionParameterTest - Use a dual-@MethodSource pattern for the six subclasses that add their own @test method needing extra args (BDay, Member, Revision, Source, Uid, Url) - Rename the misleading junitVintage version key to junit in the version catalog - Convert pre-existing @ignore usages to @disabled Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Move the completed OpenSpec change to openspec/changes/archive/. The test-framework capability spec lives on at openspec/specs/test-framework/. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
The Java test suite was written in JUnit 4 style but the build runs with
useJUnitPlatform()and only Jupiter on the test runtime classpath. With no vintage engine registered, JUnit Platform was silently skipping every JUnit 4 test class at discovery time — most of the vCard property and parameter coverage was effectively offline.This PR completes the full migration to JUnit 5 Jupiter. The vintage engine is added as a temporary bridge, all test sources are migrated, and vintage is then removed.
Key changes
org.junit.jupiter.api.*andorg.junit.jupiter.params.*PropertyTestandParameterTestbecome abstract@ParameterizedTesthosts; subclasses now supply onlypublic static Stream<Arguments> parameters()ExtensionPropertyTestandExtensionParameterTestpreserve the base classes' own parameter rows@Testmethods needing extra args (BDay,Member,Revision,Source,Uid,Url) use a dual-@MethodSourcepatternjunitVintageversion key renamed tojunit@Ignoreusages converted to@DisabledVerification
./gradlew clean test→ BUILD SUCCESSFUL: 1101 tests, 0 failures, 0 errors, 13 skippedorg.junit.{Test,Assert,Before,After,Ignore,runner,runners}imports remaintestRuntimeClasspathNotes
openspec/changes/migrate-junit4-tests-to-junit5/for the full proposal, design, and per-phase task breakdown.Test plan
build/test-results/test/include every JUnit 4 class that was previously missing (spot checkAgentTest,PropertyTestsubclasses)grep -rE "org\.junit\.(Test|Assert|Before|After|Ignore|runner|runners)\b" src/test/java🤖 Generated with Claude Code