Skip to content

Migrate most tests to JUnit 5 #2931

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 7 commits into from
Dec 23, 2021

Conversation

Bennett-Lynch
Copy link
Contributor

@Bennett-Lynch Bennett-Lynch commented Dec 17, 2021

JUnit 4 -> 5 migrations are often done in a 3-step process:

  1. Update dependencies to JUnit 5, including the vintage module, causing all tests to leverage the new JUnit 5 Platform (completed in [JUnit 5] Migrate to JUnit 5 Platform (with existing JUnit 4 test cases) #2850)
  2. Incrementally migrate JUnit 4 tests to JUnit 5 tests
  3. Once no JUnit 4 usage remains, remove the dependency on the vintage module

This PR begins step 2 by migrating tests which can be easily converted.

This PR excludes JUnit 4 tests which leverage any of the following:

  1. The expected parameter in test annotations
  2. The timeout parameter in test annotations
  3. The class-level @RunWith annotation (e.g., @RunWith(Parameterized.class) and @RunWith(MockitoJUnitRunner.class))
  4. Or if the test has child/parent classes that cannot be updated in a consistent fashion

License

  • I confirm that this pull request can be released under the Apache 2 license

@Bennett-Lynch Bennett-Lynch requested a review from a team as a code owner December 17, 2021 21:11
@Bennett-Lynch Bennett-Lynch requested a review from dagnir December 21, 2021 22:05
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2969 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@dagnir dagnir self-requested a review December 23, 2021 18:06
@Bennett-Lynch Bennett-Lynch enabled auto-merge (squash) December 23, 2021 18:08
Copy link
Contributor

@dagnir dagnir left a comment

Choose a reason for hiding this comment

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

:shipit: Please ensure the JDK8 build job is passing before merging

@Bennett-Lynch Bennett-Lynch merged commit abe96fd into aws:master Dec 23, 2021
Bennett-Lynch pushed a commit to Bennett-Lynch/aws-sdk-java-v2 that referenced this pull request Jan 14, 2022
…ert "Migrate most tests to JUnit 5 (aws#2931)"

This partially reverts commit abe96fd (aws#2931).
Only tests that use org.junit.Rule are reverted as they are not
compatible with JUnit 5.

This also upgrades surefire-junit47 to surefire-junit-platform to be
compatible with the junit-jupiter test platform.
Bennett-Lynch added a commit that referenced this pull request Jan 14, 2022
…ert "Migrate most tests to JUnit 5 (#2931)" (#2970)

Upgrade surefire-junit47 to surefire-junit-platform and partially revert "Migrate most tests to JUnit 5 (#2931)"

This partially reverts commit abe96fd (#2931).
Only tests that use org.junit.Rule are reverted as they are not
compatible with JUnit 5.

This also upgrades surefire-junit47 to surefire-junit-platform to be
compatible with the junit-jupiter test platform.
aws-sdk-java-automation added a commit that referenced this pull request Mar 21, 2024
…dbe5e1150

Pull request: release <- staging/ac5315e1-acb2-4b18-bb3a-079dbe5e1150
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