diff --git a/pitest-maven-verification/src/test/resources/pit-testng-jmockit/pom.xml b/pitest-maven-verification/src/test/resources/pit-testng-jmockit/pom.xml
index 2b77b4258..5afa36cff 100644
--- a/pitest-maven-verification/src/test/resources/pit-testng-jmockit/pom.xml
+++ b/pitest-maven-verification/src/test/resources/pit-testng-jmockit/pom.xml
@@ -16,7 +16,7 @@
org.testng
testng
- 6.8.8
+ 6.9.10
test
diff --git a/pitest-maven-verification/src/test/resources/pit-testng/pom.xml b/pitest-maven-verification/src/test/resources/pit-testng/pom.xml
index d46904b35..606b269b3 100644
--- a/pitest-maven-verification/src/test/resources/pit-testng/pom.xml
+++ b/pitest-maven-verification/src/test/resources/pit-testng/pom.xml
@@ -10,7 +10,7 @@
org.testng
testng
- 6.1.1
+ 6.9.10
test
diff --git a/pitest/src/main/java/org/pitest/testng/TestNGTestUnit.java b/pitest/src/main/java/org/pitest/testng/TestNGTestUnit.java
index c32fa2c16..7bdd5447e 100644
--- a/pitest/src/main/java/org/pitest/testng/TestNGTestUnit.java
+++ b/pitest/src/main/java/org/pitest/testng/TestNGTestUnit.java
@@ -26,6 +26,7 @@
import org.testng.IInvokedMethodListener;
import org.testng.ITestContext;
import org.testng.ITestListener;
+import org.testng.ITestNGListener;
import org.testng.ITestResult;
import org.testng.SkipException;
import org.testng.TestNG;
@@ -47,8 +48,9 @@ public class TestNGTestUnit extends AbstractTestUnit {
private static final MutableTestListenerWrapper LISTENER = new MutableTestListenerWrapper();
static {
- TESTNG.addListener(LISTENER);
- TESTNG.addInvokedMethodListener(new FailFast(LISTENER));
+ // force using TestNG.addListener(ITestNGListener) to be compatible with TestNG 7.x
+ TESTNG.addListener((ITestNGListener)LISTENER);
+ TESTNG.addListener((ITestNGListener)new FailFast(LISTENER));
}
private final Class> clazz;
diff --git a/pom.xml b/pom.xml
index 93830604a..c1767cb5c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -297,7 +297,7 @@
2.2.1
1.7.3
2.17
- 6.8.21
+ 6.9.10
1.7.12
${surefire.version}