package org.testng.junit;

import java.lang.reflect.Method;
import org.junit.runner.Description;
import org.testng.internal.Utils;

/**
 *
 * @author lukas
 */
public class JUnit4TestMethod extends JUnitTestMethod {

    public JUnit4TestMethod(JUnitTestClass owner, Description desc) {
        super(owner, desc.getMethodName(), getMethod(desc), desc);
    }

    @Override
    public Object[] getInstances() {
        return new Object[0];
    }

    private static Method getMethod(Description desc) {
        Class<?> c = desc.getTestClass();
        String method = desc.getMethodName();
        int idx = method.indexOf('[');
        if (idx != -1) {
            method = method.substring(0, idx);
        }
        try {
            return c.getMethod(method);
        } catch (Throwable t) {
            Utils.log("JUnit4TestMethod", 2,
                    "Method '" + method + "' not found in class '" + c.getName() + "': " + t.getMessage());
            return null;
        }
    }
}

@@ -582,24 +582,97 @@
 thodName();%0A
+        // remove %5Bindex%5D from method name in case of parameterized test%0A
         int 

Add comments