Skip to content

Adding recipe to return minimum JUnit version #139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 15, 2025

Conversation

lkerford
Copy link
Contributor

What's changed?

Adding a new recipe which returns the minimum JUnit version

What's your motivation?

We need a recipe to return the minimum JUnit version for the DevCenter. Currently, we are finding annotations but this finds all JUnits versions which are used not the minimum version which is used

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Some suggestions could not be made:

  • build.gradle.kts
    • lines 21-20
  • src/main/java/org/openrewrite/java/dependencies/search/FindMinimumDependencyVersion.java
    • lines 20-20

…imumDependencyVersion.java

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
"If both JUnit 4 and JUnit 5 are present, the minimum version is JUnit 4. " +
"If only one version is present, that version is the minimum version.",
example = "4",
valid = {"4", "5"},
Copy link
Contributor

@timtebeek timtebeek Apr 15, 2025

Choose a reason for hiding this comment

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

We're 3 months away from 6.0.0-M1: https://github.com/junit-team/junit5/milestone/87

Suggested change
valid = {"4", "5"},
valid = {"4", "5", "6"},

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As JUnit 6 is not released at this time, we won't know how to determine if they are using JUnit 6. We might want to add this after we know how to determine if JUnit 6 is being used

Comment on lines 63 to 66
public String getDescription() {
return "A recipe to find the minimum version of JUnit dependencies. " +
"It will search for JUnit 4 and JUnit 5 dependencies in the project. " +
"If both versions are found, it will return the minimum version of JUnit 4.";
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should call out here that this recipe is intended as a measure to tell projects that have (some) JUnit 4 apart from projects that have no JUnit 4 (but some JUnit 5). No that's a bit implied in the logic below, but making it explicit might prevent confusion for users, as well as devs that change this in months to come.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, I'm going to update the description to include more details

Copy link
Contributor

@timtebeek timtebeek left a comment

Choose a reason for hiding this comment

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

Looks good already, I've pushed some very light polish, but otherwise good to merge if you ask me. I did ask whether we should update the description, but also fine to keep that as is.

@github-project-automation github-project-automation bot moved this from In Progress to Ready to Review in OpenRewrite Apr 15, 2025
@lkerford lkerford merged commit 5d50af2 into main Apr 15, 2025
2 checks passed
@lkerford lkerford deleted the find-minimum-junit-version branch April 15, 2025 20:37
@github-project-automation github-project-automation bot moved this from Ready to Review to Done in OpenRewrite Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants