From 1c0662ea42a8c4d8cd9706ecceae4ae5bd2e9f75 Mon Sep 17 00:00:00 2001 From: Chris Vest Date: Wed, 4 Nov 2020 10:19:59 +0100 Subject: [PATCH] Use JUnit 5 for running all tests (#10764) Motivation: JUnit 5 is the new hotness. It's more expressive, extensible, and composable in many ways, and it's better able to run tests in parallel. But most importantly, it's able to directly run JUnit 4 tests. This means we can update and start using JUnit 5 without touching any of our existing tests. I'm also introducing a dependency on assertj-core, which is like hamcrest, but arguably has a nicer and more discoverable API. Modification: Add the JUnit 5 and assertj-core dependencies, without converting any tests at time time. Result: All our tests are now executed through the JUnit 5 Vintage Engine. Also, the JUnit 5 test APIs are available, and any JUnit 5 tests that are added from now on will also be executed. --- microbench/pom.xml | 15 ++++++++ pom.xml | 45 ++++++++++++++++++++++ testsuite-shading/pom.xml | 12 ++++++ testsuite/pom.xml | 20 ++++++++++ transport-native-unix-common-tests/pom.xml | 15 ++++++++ 5 files changed, 107 insertions(+) diff --git a/microbench/pom.xml b/microbench/pom.xml index b529aa182d..41573abf92 100644 --- a/microbench/pom.xml +++ b/microbench/pom.xml @@ -169,6 +169,21 @@ ${project.version} ${kqueue.classifier} + + org.junit.jupiter + junit-jupiter-api + compile + + + org.junit.jupiter + junit-jupiter-engine + compile + + + org.junit.vintage + junit-vintage-engine + compile + junit junit diff --git a/pom.xml b/pom.xml index 3966c9cb96..16eb0dd163 100644 --- a/pom.xml +++ b/pom.xml @@ -392,6 +392,7 @@ debug 2.6.2 1.4.1 + 5.7.0 ${java.home} ${testJavaHome}/bin/java false @@ -643,6 +644,24 @@ + + org.junit.jupiter + junit-jupiter-api + ${junit.version} + test + + + org.junit.jupiter + junit-jupiter-engine + ${junit.version} + test + + + org.junit.vintage + junit-vintage-engine + ${junit.version} + test + junit junit @@ -661,6 +680,12 @@ 1.3 test + + org.assertj + assertj-core + 3.18.0 + test + org.mockito mockito-core @@ -746,6 +771,21 @@ + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + org.junit.vintage + junit-vintage-engine + test + junit junit @@ -761,6 +801,11 @@ hamcrest-library test + + org.assertj + assertj-core + test + ch.qos.logback logback-classic diff --git a/testsuite-shading/pom.xml b/testsuite-shading/pom.xml index 76a06da4dc..9e1c84b58e 100644 --- a/testsuite-shading/pom.xml +++ b/testsuite-shading/pom.xml @@ -60,6 +60,18 @@ + + org.junit.jupiter + junit-jupiter-api + + + org.junit.jupiter + junit-jupiter-engine + + + org.junit.vintage + junit-vintage-engine + junit junit diff --git a/testsuite/pom.xml b/testsuite/pom.xml index 2892c09b8d..81bf879428 100644 --- a/testsuite/pom.xml +++ b/testsuite/pom.xml @@ -79,6 +79,21 @@ + + org.junit.jupiter + junit-jupiter-api + compile + + + org.junit.jupiter + junit-jupiter-engine + compile + + + org.junit.vintage + junit-vintage-engine + compile + junit junit @@ -89,6 +104,11 @@ hamcrest-library compile + + org.assertj + assertj-core + compile + org.mockito mockito-core diff --git a/transport-native-unix-common-tests/pom.xml b/transport-native-unix-common-tests/pom.xml index 46e34108a0..4b82fc540f 100644 --- a/transport-native-unix-common-tests/pom.xml +++ b/transport-native-unix-common-tests/pom.xml @@ -40,6 +40,21 @@ netty-transport-native-unix-common ${project.version} + + org.junit.jupiter + junit-jupiter-api + compile + + + org.junit.jupiter + junit-jupiter-engine + compile + + + org.junit.vintage + junit-vintage-engine + compile + junit junit