Skip to content

JUnit Jupiter migration completion#375

Closed
mureinik wants to merge 2 commits intoapache:masterfrom
mureinik:junit-jupiter
Closed

JUnit Jupiter migration completion#375
mureinik wants to merge 2 commits intoapache:masterfrom
mureinik:junit-jupiter

Conversation

@mureinik
Copy link
Copy Markdown
Contributor

This patch finalizes the upgrade of commons-lang's tests to use JUnit Jupiter and removes the Vintage Engine dependency entirely.

While most of these changes are drop-in replacements with no functional benefit, there are some non-obvious changes worth mentioning.

Unlike org.junit.Assert.assertEquals(double, double, double), org.junit.jupiter.api.Assertions.assertEquals(double, double, double) does not support deltas of zero, only strictly positive deltas.
This issue will be addressed in JUnit Jupiter 5.4 (see junit-team/junit-framework#1613 for details). In the meanwhile, assertTrue(expected==actual) was used, and TODO comments were placed in the code to refactor it to assertEquals once JUnit 5.4 is available.

Unlike org.junit.Test, org.junit.jupiter.api.Test does not have an expected argument. Instead, an explicit call to org.junit.jupiter.api.Assertions.assertThrows is used.

Unlike org.junit.Test, org.junit.jupiter.api.Test does not have a timeout argument either. Instead, an explicit call to org.junit.jupiter.api.Assertions.assertTimeoutPreemptively is used.

JUnit Jupiter also no longer has the concept of Rules. Usages of the SystemDefaultsSwitch rule and its accompanying annotates were replaced with the @DefaultLocale annotation that @britter contributed to JUnit Pioneer, the semi-official JUnit extension project, or simply removed entirely where they had no use (i.e., from StringUtilsEqulasIndexOfTest).
Following the removal of their usages, the @SystemDefaults annotation, the SystemDefaultsSwitch rule and the SystemDefaultsSwitchTest class that tests them had no more use, and they were removed entirely.

It's also worth noting this is a minimal patch for migrating the package's tests to Jupiter. There are several tests that can be made more elegant with Jupiter's new features, but that work is left for subsequent patches.

Commit 0223a4 removed all the usages of @SystemDefaults annotations from
this test, but left behind a pointless SystemDefaultsSwitch rule. This
patch finishes the job and removes this unused rule.
This patch finalizes the upgrade of commons-lang's tests to use JUnit
Jupiter and remove the Vintage Engine dependency entirely.

While most of these changes are drop-in replacements with no functional
benefit, there are some non-obvious changes worth mentioning.

Unlike org.junit.Assert.assertEquals(double, double, double),
org.junit.jupiter.api.Assertions.assertEquals(double, double, double)
does not support deltas of zero, only strictly positive deltas.
This issue will be addressed in JUnit Jupiter 5.4 (see
junit-team/junit-framework#1613 for details). In the
meanwhile, assertTrue(expected==actual) was used, and TODO comments were
placed in the code to refactor it to assertEquals once JUnit 5.4 is
available.

Unlike org.junit.Test, org.junit.jupiter.api.Test does not have an
"expected" argument. Instead, an explicit call to
org.junit.jupiter.api.Assertions.assertThrows is used.

Unlike org.junit.Test, org.junit.jupiter.api.Test does not have a
"timeout" argument either. Instead, an explicit call to
org.junit.jupiter.api.Assertions.assertTimeoutPreemptively is used.

JUnit Jupiter also no longer has the concept of Rules. Usages of the
SystemDefaultsSwitch rule and its accompanying annotates were replaced
with the @DefaultLocale annotation that Benedikt Ritter contributed to
JUnit Pioneer, the semi-official JUnit extension project.
Following the removal of their usages, the SystemDefaults annotation,
the SystemDefaultsSwitch rule and the SystemDefaultsSwitchTest class
that tests them had no more use, and they were removed entirely.

It's also worth noting this is a minimal patch for migrating the
package's tests to Jupiter. There are several tests that can be made
more elegant with Jupiter's new features, but that work is left for
subsequent patches.
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.007%) to 95.253% when pulling 8577320 on mureinik:junit-jupiter into ca2e59c on apache:master.

@PascalSchumacher
Copy link
Copy Markdown
Contributor

Thank you very much for this massive effort! 👍

@asfgit asfgit closed this in e99b0dd Oct 11, 2018
@mureinik mureinik deleted the junit-jupiter branch October 31, 2018 16:51
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