1 package org.testng.junit; 2 3 import java.lang.reflect.Method; 4 import junit.framework.Test; 5 import org.testng.internal.Utils; 6 7 /** 8 * 9 * @author lukas 10 */ 11 public class JUnit3TestMethod extends JUnitTestMethod { 12 JUnit3TestMethod(JUnitTestClass owner, Test test)13 public JUnit3TestMethod(JUnitTestClass owner, Test test) { 14 super(owner, getMethod(test), test); 15 } 16 getMethod(Test t)17 private static Method getMethod(Test t) { 18 String name = null; 19 try { 20 Method nameMethod = t.getClass().getMethod("getName"); 21 name = (String) nameMethod.invoke(t); 22 return t.getClass().getMethod(name); 23 } catch (Throwable th) { 24 Utils.log("JUnit3TestMethod", 2, 25 "Method '" + name + "' not found in class '" + t + "': " + th.getMessage()); 26 return null; 27 } 28 } 29 } 30