Skip to content

GH-3618: Migrate multiple modules to JUnit5#3673

Open
nastra wants to merge 1 commit into
apache:masterfrom
nastra:junit5
Open

GH-3618: Migrate multiple modules to JUnit5#3673
nastra wants to merge 1 commit into
apache:masterfrom
nastra:junit5

Conversation

@nastra

@nastra nastra commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

Now that these modules have been migrated to AssertJ assertions, migrating them to JUnit5 is trivial and mostly requires import changes.
While this touches 180+ files, there are actually < 10 files that have substantial changes (mostly around parameterized testing). All the other files have pure import changes. JUnit5 doesn't support built-in class-level test parameterization and so those tests were converted to parameterize at the method level.

I'll have a second PR that will migrate parquet-hadoop to JUnit5 because that requires few more substantial changes

What changes are included in this PR?

Are these changes tested?

yes

Are there any user-facing changes?

no

import org.junit.jupiter.api.Test;
import org.junit.jupiter.migrationsupport.rules.EnableRuleMigrationSupport;

@EnableRuleMigrationSupport

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these JUnit benchmarks depend on com.carrotsearch.junitbenchmarks.BenchmarkRule which is only available for JUnit4, so we can't really convert that Rule to JUnit5. We're making sure that this uses JUnit5 imports but runs with the migration module, which supports JUnit4 rule execution

import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;

@RunWith(Parameterized.class)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JUnit5 doesn't have class-level parameterization unfortunately, so everything is parameterized at the method level

@nastra
nastra marked this pull request as draft July 17, 2026 07:36
public Integer offset;

@Parameters
public static List<Object[]> parameters() {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this refactors the test slightly to have nested test classes that use their own parameters

@nastra
nastra marked this pull request as ready for review July 17, 2026 07:42
@nastra

nastra commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

/cc @Fokko @wgtmac

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