Skip to content

Enable having JUnit6 tests for jena-core#3986

Merged
afs merged 4 commits into
apache:mainfrom
afs:junit6-core
Jun 12, 2026
Merged

Enable having JUnit6 tests for jena-core#3986
afs merged 4 commits into
apache:mainfrom
afs:junit6-core

Conversation

@afs

@afs afs commented Jun 10, 2026

Copy link
Copy Markdown
Member

Steps towards updating the jena-core tests.

This makes it possible to have JUnit6 tests in jena-core.

  1. Split into two sets of tests -- JenaCoreTestAll_JU6 and JenaCoreTestAll_JU4
  2. Convert some of the packages to JUnit6, especially those that were JUnit4, not JUnit3.
  3. Tidy up and rationalize; de-duplicate.

The jena-core POM now names these two classes.

I was hoping to use JUnit4 directly, and not junit-vintage-engine, which is deprecated and may be removed.

This would mean two test phases, different surefire providers, but I haven't managed to get surefire to work with this.

It has to use the vintage engine. If the POM depends on JUnit4, not junit-vintage-engine, then one or other of the test suite isn't found.


  • Tests are included.
  • Commits have been squashed to remove intermediate development commit messages.
  • Key commit messages start with the issue number (GH-xxxx)

By submitting this pull request, I acknowledge that I am making a contribution to the Apache Software Foundation under the terms and conditions of the Contributor's Agreement.

@afs afs force-pushed the junit6-core branch 3 times, most recently from 66ab50b to cf756a2 Compare June 10, 2026 21:20
@afs

afs commented Jun 11, 2026

Copy link
Copy Markdown
Member Author

The conversion is guided AI and human checking.

@arne-bdt -- I'm going to add converting jena-core/src/test/java/org/apache/jena/mem/ from JUnit4 to JUnit6 to this PR.

That's much easier (= much more reliable in copilot) than JUnit3 conversion. It's almost applying certain fixed conversions. Only parameterization is different.

JUnit3 conversion is made complicated by the amount of local infrastructure. It shows the JUnit3 framework was quite basic. The local JUnit3-related code around the tests is providing what in effect is parameterization, shared tests, and the way tests are grouped together, all of which are quite different in JUnit nowadays.

@afs afs marked this pull request as draft June 11, 2026 09:59
@afs

afs commented Jun 11, 2026

Copy link
Copy Markdown
Member Author

Done! as a separate commit. The bulk was automatic but this time a lot of manual ... because I ran out of quota.

But JUnit4 to JUnit6 is much less of a bump:

  1. Change imports
  2. Check for assert order if the assert has a message
  3. Formulaic rewrite @Parameterized to @ParamterizedClass

The test count in Eclipse for mem.GraphMemIndexedSetTest is different by 5 (the number of strategies). JUnit4 and JUnit6 count AbstractGraphMemTest.testDeleteAll and it's overrided method differently.

Difference between runtime and static counting maybe.
JUnit4 counts the test and the override by class scanning, whereas JUnit6 counts one run.

@afs afs marked this pull request as ready for review June 11, 2026 15:44
@afs afs merged commit da0fb4e into apache:main Jun 12, 2026
@afs afs deleted the junit6-core branch June 12, 2026 12:03
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