Skip to content

Migrate to JUnit 5 #123

@jacobperron

Description

@jacobperron

Currently, unit tests depend on JUnit 4 explicitly (downloading it if it is not available):

find_jar(JUNIT_JAR NAMES junit VERSIONS 4)
if(${JUNIT_JAR})
list(APPEND exported_jars ${JUNIT_JAR})
else()
set(junit_version "4.12")
set(junit_sha256 "59721f0805e223d84b90677887d9ff567dc534d7c502ca903c0c2b17f05c116a")
set(junit_url "https://repo1.maven.org/maven2/junit/junit/${junit_version}/junit-${junit_version}.jar")
set(junit_jar_path "${CMAKE_CURRENT_BINARY_DIR}/jars/junit-${junit_version}.jar")
file(DOWNLOAD ${junit_url} ${junit_jar_path} EXPECTED_HASH SHA256=${junit_sha256})

By switching to JUnit 5, we can take advantage of new features and the extensibility of it's modular architecture.

At the moment, there aren't many instances I can point to that would justify switching, besides this TODO:

// TODO(jacobperron): Replace with JUnit's assertThrows method when we switch to JUnit 5
// See: https://junit.org/junit5/docs/5.0.1/api/org/junit/jupiter/api/Assertions.html

I haven't investigated how easy it would be to switch; it may be as simple as update the CMake snippet referenced above.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions