Skip to content

Commit

Permalink
feat: reworks testng7 support (#261)
Browse files Browse the repository at this point in the history
Fixes #258
  • Loading branch information
Zlika authored Aug 12, 2020
1 parent 0082d1e commit 415d0bb
Show file tree
Hide file tree
Showing 32 changed files with 22 additions and 1,881 deletions.
17 changes: 0 additions & 17 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -171,23 +171,6 @@
<version>${project.version}</version>
</dependency>

<!-- TestNG 7 -->
<dependency>
<groupId>org.jboss.arquillian.testng</groupId>
<artifactId>arquillian-testng7-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.testng</groupId>
<artifactId>arquillian-testng7-container</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.testng</groupId>
<artifactId>arquillian-testng7-standalone</artifactId>
<version>${project.version}</version>
</dependency>

<!-- Protocols -->
<dependency>
<groupId>org.jboss.arquillian.protocol</groupId>
Expand Down
1 change: 0 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@

<module>junit</module>
<module>testng</module>
<module>testng7</module>

<module>testenrichers</module>
<module>protocols</module>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package org.jboss.arquillian.testng;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Stack;
import org.jboss.arquillian.test.spi.LifecycleMethodExecutor;
Expand All @@ -29,6 +30,7 @@
import org.testng.IHookable;
import org.testng.IInvokedMethod;
import org.testng.IInvokedMethodListener;
import org.testng.ITestNGMethod;
import org.testng.ITestResult;
import org.testng.SkipException;
import org.testng.annotations.AfterClass;
Expand Down Expand Up @@ -177,7 +179,26 @@ public String getMethodName() {
}

public Method getMethod() {
return testResult.getMethod().getMethod();
final ITestNGMethod testNGMethod = testResult.getMethod();
// ITestNGMethod.getMethod() is deprecated since TestNG 6.0.1
// and was removed in TestNG 7.0.0, replaced by getConstructorOrMethod().
Method method = null;
try {
method = testNGMethod.getClass().getMethod("getMethod");
} catch (NoSuchMethodException e) {
try {
method = testNGMethod.getClass().getMethod("getConstructorOrMethod");
} catch (NoSuchMethodException e1) {
throw new RuntimeException(e1);
}
}
try {
return (Method) method.invoke(testNGMethod);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
}
}

public Object getInstance() {
Expand Down
104 changes: 0 additions & 104 deletions testng7/container/pom.xml

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 415d0bb

Please sign in to comment.