Skip to content

Conversation

mureinik
Copy link
Contributor

@mureinik mureinik commented Oct 1, 2022

This PR upgrades the project to use the modern JUnit Jupiter 5.9.1 in order to make it easier for future contributors to write and maintain tests.

It includes:

  1. pom.xml
    1. Replace the dependency junit:junit:4.10 with the modern org.junit.jupiter:junit-jupiter.5.9.0.
    2. Explicitly define the org.apache.maven.plugins:maven-surefire-plugin:2.22.2 dependency in order to execute JUnit Jupiter tests.
  2. Annotations
    1. org.junit.jupiter.api.Test was used as a drop-in replacement for org.junit.Test in the simple case where the annotation takes no arguments. In the cases the expected argument was used the annotation was still replaced, but the assertions had to also be changed, see 3.ii. below.
    2. org.junit.jupiter.api.BeforeEach was used as a drop-in replacement for org.junit.Before.
    3. org.junit.jupiter.api.BeforeAll was used as a drop-in replacement for org.junit.BeforeAll.
  3. Assertions
    1. The methods of org.junit.jupiter.api.Assertions were used as drop-in replacements for the methods of org.junit.Assert with the same name.
    2. org.junit.jupiter.api.Assertions' assertThrows was used as a replacement for the org.junit.Test annotation with an expected argument.

This patch upgrades the project to use the modern JUnit Jupiter 5.9.1
in order to make it easier for future contributors to write and
maintain tests.

It includes:
1. pom.xml
   a. Replace the dependency junit:junit:4.10 with the modern
      org.junit.jupiter:junit-jupiter.5.9.0.
   b. Explicitly define the
      org.apache.maven.plugins:maven-surefire-plugin:2.22.2 dependency
      in order to execute JUnit Jupiter tests.

2. Annotations
   a. org.junit.jupiter.api.Test was used as a drop-in replacement for
      org.junit.Test in the simple case where the annotation takes no
      arguments. In the cases the expected argument was used the
      annotation was still replaced, but the assertions had to also be
      changed, see 3.b. below.
   b. org.junit.jupiter.api.BeforeEach was used as a drop-in
      replacement for org.junit.Before.
   c. org.junit.jupiter.api.BeforeAll was used as a drop-in
      replacement for org.junit.BeforeAll.

3. Assertions
   a. The methods of org.junit.jupiter.api.Assertions were used as
      drop-in replacements for the methods of org.junit.Assert with
      the same name.
   b. org.junit.jupiter.api.Assertions' assertThrows was used as a
      replacement for the org.junit.Test annotation with an expected
      argument.
@kinow kinow closed this in c32b06e Oct 1, 2022
@kinow kinow merged commit bf276a8 into tupilabs:master Oct 1, 2022
Copy link
Member

@kinow kinow left a comment

Choose a reason for hiding this comment

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

Merged! Thanks @mureinik !

@mureinik mureinik deleted the junit-jupiter branch October 1, 2022 20:37
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