-
Notifications
You must be signed in to change notification settings - Fork 1k
/
JUnit3TestMethod.java
33 lines (29 loc) · 1013 Bytes
/
JUnit3TestMethod.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package org.testng.junit;
import java.lang.reflect.Method;
import junit.framework.Test;
import org.testng.ITestObjectFactory;
import org.testng.internal.ConstructorOrMethod;
import org.testng.internal.Utils;
/**
* @deprecated - Support for running JUnit tests stands deprecated as of TestNG <code>7.6.2</code>
*/
@Deprecated
public class JUnit3TestMethod extends JUnitTestMethod {
public JUnit3TestMethod(ITestObjectFactory objectFactory, JUnitTestClass owner, Test test) {
super(objectFactory, owner, getMethod(test), test);
}
private static ConstructorOrMethod getMethod(Test t) {
String name = null;
try {
Method nameMethod = t.getClass().getMethod("getName");
name = (String) nameMethod.invoke(t);
return new ConstructorOrMethod(t.getClass().getMethod(name));
} catch (Throwable th) {
Utils.log(
"JUnit3TestMethod",
2,
"Method '" + name + "' not found in class '" + t + "': " + th.getMessage());
return null;
}
}
}