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 servicetalk-client-api-internal from jUnit4 to jUnit5 #1608

Merged
merged 4 commits into from
Jun 8, 2021

Conversation

amitvc
Copy link
Contributor

@amitvc amitvc commented Jun 3, 2021

Motivation:

JUnit 5 leverages features from Java 8 or later, such as lambda functions, making tests more powerful and easier to maintain.
JUnit 5 has added some very useful new features for describing, organizing, and executing tests. For instance, tests get better display names and can be organized hierarchically.
JUnit 5 is organized into multiple libraries, so only the features you need are imported into your project. With build systems such as Maven and Gradle, including the right libraries is easy.
JUnit 5 can use more than one extension at a time, which JUnit 4 could not (only one runner could be used at a time). This means you can easily combine the Spring extension with other extensions (such as your own custom extension).
Modifications:

Unit tests have been migrated from JUnit 4 to JUnit 5
Result:

Module servicetalk-client-api-internal now runs tests using JUnit 5

@idelpivnitskiy idelpivnitskiy mentioned this pull request Jun 3, 2021
44 tasks
Copy link
Member

@idelpivnitskiy idelpivnitskiy left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @amitvc!

Please, make sure that the build runs correctly. Currently, quality task failed with:

Execution failed for task ':servicetalk-client-api-internal:pmdTest'.
> 35 PMD rule violations were found. See the report at: file:///home/runner/work/servicetalk/servicetalk/servicetalk-client-api-internal/build/reports/pmd/test.html

@amitvc
Copy link
Contributor Author

amitvc commented Jun 8, 2021

@idelpivnitskiy pushed another revision. Successfully ran ./gradlew --parallel clean quality locally as well as test.

@idelpivnitskiy
Copy link
Member

idelpivnitskiy commented Jun 8, 2021

The CI reports:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':servicetalk-client-api-internal:pmdTest'.
> 35 PMD rule violations were found. See the report at: file:///home/runner/work/servicetalk/servicetalk/servicetalk-client-api-internal/build/reports/pmd/test.html

This happens because CI always cherry-picks changes from PR to the up-to-date main branch. Right before your PR we added a new PMD rule for jUnit5 tests (see #1596). Looks like you branched out before that PR was merged.

Please, merge the main branch into yours or rebase and fix the PMD warnings. Otherwise, PR looks great!

@idelpivnitskiy idelpivnitskiy changed the title Initial draft to upgrade module to junit5 Migrate servicetalk-client-api-internal from jUnit4 to jUnit5 Jun 8, 2021
@amitvc
Copy link
Contributor Author

amitvc commented Jun 8, 2021

@idelpivnitskiy thanks for the review. I have merged the main branch into mine. Hopefully, the build will go through. I will work on other packages in the list from the original issue.

@bondolo bondolo self-assigned this Jun 8, 2021
@idelpivnitskiy
Copy link
Member

@amitvc it was not enough just to merge main into your branch. Merging just gives you up to date version of PMD rules, the same as the CI sees. Now, run:

./gradlew :servicetalk-client-api-internal:build

And make sure it succeeds.

@amitvc
Copy link
Contributor Author

amitvc commented Jun 8, 2021

@idelpivnitskiy thanks for the hint. Indeed when I run on this locally it fails. I am fixing this now.

@bondolo bondolo merged commit 83c9206 into apple:main Jun 8, 2021
@bondolo
Copy link
Contributor

bondolo commented Jun 8, 2021

Thank you @amitvc !

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