Skip to content
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

Migrate tests to JUnit5 #3221

Merged
merged 2 commits into from
Dec 3, 2024
Merged

Migrate tests to JUnit5 #3221

merged 2 commits into from
Dec 3, 2024

Conversation

strangelookingnerd
Copy link
Contributor

There are already some tests that already use JUnit5 as well as some pending PRs (#3219, #3218, ...) to migrate more. This PR will migrate all (*) tests to JUnit5.

Migration includes:

  • Using JUnit5 annotations
  • Using Assertions
  • Remove public modifiers from test classes and methods
  • Clean up assertions (switching expected and actual, simplyifing assertions...)
  • Trivial code cleanup

I validated my changes using ./mvnw verify and

(*) Some tests use org.junit.Rule implementations that do not have a JUnit5 replacement and implementing these is non-trivial from what I can tell. Further there are some instances of other testing frameworks that do not yet support JUnit5. I plan on looking into these cases as well but deliberately did not include them in this PR.

Checklist

  • Base your changes on 2.x branch if you are targeting Log4j 2; use main otherwise
  • ./mvnw verify succeeds (if it fails due to code formatting issues reported by Spotless, simply run ./mvnw spotless:apply and retry)
  • Non-trivial changes contain an entry file in the src/changelog/.2.x.x directory
  • Tests for the changes are provided
  • Commits are signed (optional, but highly recommended)

@ppkarwasz
Copy link
Contributor

@strangelookingnerd,

It will take me some time to scroll through all the changes in this PR, but I'll try to review this and your other PRs by the end of next week.

Copy link

github-actions bot commented Nov 20, 2024

Job Requested goals Build Tool Version Build Outcome Build Scan®
build-macos-latest clean install 3.9.8 Build Scan PUBLISHED
build-ubuntu-latest clean install 3.9.8 Build Scan PUBLISHED
build-windows-latest clean install 3.9.8 Build Scan PUBLISHED
Generated by gradle/develocity-actions

@ppkarwasz
Copy link
Contributor

@strangelookingnerd,

Do you have a deadline for the "Migrate to JUnit 5" task? We are swamped with work these days, so the review might take more time than anticipated.

@strangelookingnerd
Copy link
Contributor Author

@strangelookingnerd,

Do you have a deadline for the "Migrate to JUnit 5" task? We are swamped with work these days, so the review might take more time than anticipated.

Not at all. I fully understand that the changeset is quite large and will take its time to review. I still hope that it will be merged eventually and I will try my best to keept it up-to-date and free of merge confilict 👍🏼

@jvz
Copy link
Member

jvz commented Dec 3, 2024

I'll review this, especially since converting tests from v4 to v5 was one of my "hobbies" in this project not that long ago.

@jvz jvz self-assigned this Dec 3, 2024
Copy link
Member

@jvz jvz left a comment

Choose a reason for hiding this comment

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

Had to review this in IntelliJ as the web UI can barely handle this. Unfortunately, I can't approve it from IntelliJ due to some Apache org settings. So here I am back in the web UI to say LGTM.

@jvz jvz merged commit 5df0a57 into apache:2.x Dec 3, 2024
9 checks passed
@strangelookingnerd strangelookingnerd deleted the migrate_to_junit5 branch December 4, 2024 11:28
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.

3 participants