Upgrade to TestNG 6.9.12

This commit is contained in:
Sam Brannen 2016-09-09 18:02:47 +02:00
parent e882f739bf
commit 2f2e6dffb4
4 changed files with 21 additions and 5 deletions

View File

@ -86,7 +86,7 @@ configure(allprojects) { project ->
ext.slf4jVersion = "1.7.21"
ext.snakeyamlVersion = "1.17"
ext.snifferVersion = "1.15"
ext.testngVersion = "6.9.10"
ext.testngVersion = "6.9.12"
ext.tiles3Version = "3.0.5"
ext.tomcatVersion = "8.5.4"
ext.tyrusVersion = "1.13"

View File

@ -178,7 +178,6 @@ public abstract class AbstractTestNGSpringContextTests implements IHookable, App
beforeCallbacksExecuted = true;
}
catch (Throwable ex) {
testResult.setThrowable(ex);
this.testException = ex;
}
@ -192,10 +191,13 @@ public abstract class AbstractTestNGSpringContextTests implements IHookable, App
}
catch (Throwable ex) {
if (this.testException == null) {
testResult.setThrowable(ex);
this.testException = ex;
}
}
if (this.testException != null) {
throwAsUncheckedException(this.testException);
}
}
/**
@ -237,4 +239,16 @@ public abstract class AbstractTestNGSpringContextTests implements IHookable, App
return testResultException;
}
private RuntimeException throwAsUncheckedException(Throwable t) {
throwAs(t);
// Appeasing the compiler: the following line will never be executed.
return null;
}
@SuppressWarnings("unchecked")
private <T extends Throwable> void throwAs(Throwable t) throws T {
throw (T) t;
}
}

View File

@ -36,6 +36,7 @@ import org.springframework.test.context.support.DirtiesContextTestExecutionListe
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.springframework.test.context.testng.TrackingTestNGTestListener;
import org.testng.ITestNGListener;
import org.testng.TestNG;
import static org.junit.Assert.*;
@ -142,7 +143,7 @@ public class ClassLevelDirtiesContextTestNGTests {
final TrackingTestNGTestListener listener = new TrackingTestNGTestListener();
final TestNG testNG = new TestNG();
testNG.addListener(listener);
testNG.addListener((ITestNGListener) listener);
testNG.setTestClasses(new Class<?>[] { testClass });
testNG.setVerbose(0);
testNG.run();

View File

@ -32,6 +32,7 @@ import org.springframework.test.context.transaction.AfterTransaction;
import org.springframework.test.context.transaction.BeforeTransaction;
import org.springframework.util.ClassUtils;
import org.testng.ITestNGListener;
import org.testng.TestNG;
import static org.junit.Assert.*;
@ -90,7 +91,7 @@ public class FailingBeforeAndAfterMethodsTestNGTests {
public void runTestAndAssertCounters() throws Exception {
final TrackingTestNGTestListener listener = new TrackingTestNGTestListener();
final TestNG testNG = new TestNG();
testNG.addListener(listener);
testNG.addListener((ITestNGListener) listener);
testNG.setTestClasses(new Class<?>[] { this.clazz });
testNG.setVerbose(0);
testNG.run();