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 modern JUnit Jupiter #51

Merged
merged 1 commit into from
Oct 1, 2021

Conversation

mureinik
Copy link
Contributor

@mureinik mureinik commented Oct 1, 2021

The project currently uses the outdated JUnit 4.13.2. In order to make it easier to write tests and easier for future contributors to easily start working with the project, this path migrates the test suite to the modern JUnit Jupiter.

Changes:

  • The junit:junit:4.13.2 dependency was replaced with org.junit.jupiter:junit-jupiter:5.8.1.
  • The org.junit.jupiter.api.Test annotation was used as a drop-in replacement for org.junit.Test.
  • The static imports from org.junit.jupiter.api.Assertions were used as drop-in replacements for the static imports from org.junit.Assert.
  • LineEndingEdgeCasesTest was rewritten to use JUnit Jupiter's org.junit.jupiter.api.io.TempDir annotation instead of JUnit 4's org.junit.rules.TemporaryFolder.

The project currently uses the outdated JUnit 4.13.2. In order to make
it easier to write tests and easier for future contributors to easily
start working with the project, this path migrates the test suite to
the modern JUnit Jupiter.

Changes:
- The junit:junit:4.13.2 dependency was replaced with
  org.junit.jupiter:junit-jupiter:5.8.1.
- The org.junit.jupiter.api.Test annotation was used as a drop-in
  replacement for org.junit.Test
- The static imports from org.junit.jupiter.api.Assertions were used
  as drop-in replacements for the static imports from
  org.junit.Assert.
- LineEndingEdgeCasesTest was rewritten to use JUnit Jupiter's
  org.junit.jupiter.api.io.TempDir annotation instead of JUnit 4's
  org.junit.rules.TemporaryFolder.
Copy link
Member

@ctubbsii ctubbsii 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 contribution, @mureinik !

I would have preferred we keep the temp directory under target/, but this change is okay as-is.

@ctubbsii ctubbsii added this to the 1.7.0 milestone Oct 1, 2021
@ctubbsii ctubbsii merged commit 433489d into revelc:main Oct 1, 2021
@mureinik mureinik deleted the junit-jupiter branch October 1, 2021 17:27
mureinik added a commit to mureinik/impsort-maven-plugin that referenced this pull request Oct 2, 2021
This patch follows up on the review given for revelc#51 and uses
maven-surefire-plugin's configuration to set the tempdir to target and
restore the behavior change introduced in that PR.

Note: This fix will only effect running the test via maven. If the
test is manually run (e.g., from an IDE), java.io.tmpdir should be
overridden manually too.
mureinik added a commit to mureinik/impsort-maven-plugin that referenced this pull request Oct 2, 2021
This patch follows up on the review given for revelc#51 and uses
maven-surefire-plugin's configuration to set the tempdir to target and
restore the behavior change introduced in that PR.

Note: This fix will only effect running the test via maven. If the
test is manually run (e.g., from an IDE), java.io.tmpdir should be
overridden manually too.
ctubbsii added a commit that referenced this pull request Oct 2, 2021
This patch follows up on the review given for #51 and uses
maven-surefire-plugin's configuration to set the tempdir to target and
restore the behavior change introduced in that PR.

Note: This fix will only effect running the test via maven. If the
test is manually run (e.g., from an IDE), java.io.tmpdir should be
overridden manually too.

Move surefire version to managed property by overriding property
in parent POM

Co-authored-by: Christopher Tubbs <ctubbsii@apache.org>
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