Skip to content

Migrate from JUnit 4 to JUnit 5

Robert Elliot requested to merge junit5 into develop

Checked that it runs exactly the same number of tests as previously.

Unfortunately there's no easy way in Maven to prevent JUnit 4 creeping back onto the compile time classpath via a transitive dependency. Maven doesn't distinguish between compile & runtime for test scope (why not?!) so I can’t just drop it down to be a runtime scoped dependency.

Testcontainers needs it as a runtime dependency, so excluding it is not an option - and you can't globally exclude a dependency in Maven, so it could always creep back on via another dependency anyway.

A checkstyle like check would be the only way, I think.

Or migrate to gradle.

Merge request reports