openrewrite / openrewrite/rewrite-testing-frameworks

JUnit 4 to 5: use @ParameterizedClass when converting parameterized tests

Open
#743 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement recipe
Dominant language
Java
Stars
100
Forks
105
Avg merge
2h 25m
Merged PRs (30d)
9

Description

What problem are you trying to solve?

JUnit 5.13 introduced @ParameterizedClass which is much closer to JUnit 4 semantics, so rewrite won't need extra init methods.

Recent Java versions could even use @ParameterizedClass record, however, it might be harder to implement.

Describe the solution you'd like

Use @ParameterizedClass instead of @ParameterizedTest.

Additional context

https://junit.org/junit5/docs/current/user-guide/#writing-tests-parameterized-tests-consuming-arguments-classes

Are you interested in contributing this feature to OpenRewrite?

I might contribute

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the JUnit 5.13 documentation for @ParameterizedClass and the linked section on consuming arguments. Then inspect the existing JUnit 4 parameterized-test conversion entry points and their tests. Done means conversions use @ParameterizedClass rather than @ParameterizedTest while preserving JUnit 4 semantics; record support is optional context, not a defined requirement.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.