Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR upgrades the project to use the modern JUnit Jupiter 5.9.1 instead of the outdated JUnit 4.13.1 in order to make it easier for future contributors to write and maintain unit tests in the project.
Note:
While this patch doesn't contain any significant logic, it's already quite large. In an attempt to keep it as easy as possible to review, it was kept minimal and only replaces JUnit 4 constructs with JUnit Jupiter constructs.
With JUnit Jupiter in place, some obvious improvements/cleanups are available, but they will be performed in a followup patch.
This PR includes:
junit:junit:4.13.1
dependency was replaced with the modernorg.junit.jupiter:junit-jupiter:5.9.1
dependencymaven-surefire-plugin:2.22.2
was introduced instead of the implicit2.12
version that was not specified in order to be able to execute JUnit Jupiter tests.maven-dependency-plugin
'sexcludeArtifactIds
configuration was updated to excludejunit-jupiter
instead ofjunit
org.junit.jupiter.api.Test
was used as a drop-in replacement fororg.junit.Test
in the simple case where no arguments were used with the annotation. In the case where theexpected
argument was used this annotation was still used, but the assertions in the test had to be modified, see 3.iii beloworg.junit.jupiter.api.BeforeEach
was used as a drop-in replacement fororg.junit.Before
.org.junit.jupiter.api.BeforeAll
was used as a drop-in replacement fororg.junit.BeforeClass
.org.junit.jupiter.api.AfterEach
was used as a drop-in replacement fororg.junit.After
.org.junit.jupiter.api.AfterAll
was used as a drop-in replacement fororg.junit.AfterClass
.org.junit.jupiter.api.Assertions
' methods were used as drop-in replacements fororg.junit.Assert
's methods with the same name in the simple case where the method was used without the extra message argument.org.junit.Assert
method was used with the extra message argument it was replaced with a call to anorg.junit.jupiter.api.Assertions
method with the same name, and the arguments were rearranged so that the message argument would be last instead of first.org.junit.jupiter.api.Assertions
'assertThrows
was used to test expected exceptions being thrown whereorg.junit.Test
was used with theexpected
argument.