package org.junit.runners.model; import java.lang.annotation.Annotation; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.lang.reflect.Type; import java.util.List; import org.junit.internal.runners.model.ReflectiveCallable; /** * Represents a method on a test class to be invoked at the appropriate point in * test execution. These methods are usually marked with an annotation (such as * {@code @Test}, {@code @Before}, {@code @After}, {@code @BeforeClass}, * {@code @AfterClass}, etc.) */ public class FrameworkMethod extends FrameworkMember { final Method fMethod; /** * Returns a new {@code FrameworkMethod} for {@code method} */ public FrameworkMethod(Method method) { fMethod= method; } /** * Returns the underlying Java method */ public Method getMethod() { return fMethod; } /** * Returns the result of invoking this method on {@code target} with * parameters {@code params}. {@link InvocationTargetException}s thrown are * unwrapped, and their causes rethrown. */ public Object invokeExplosively(final Object target, final Object... params) throws Throwable { return new ReflectiveCallable() { @Override protected Object runReflectiveCall() throws Throwable { return fMethod.invoke(target, params); } }.run(); } /** * Returns the method's name */ public String getName() { return fMethod.getName(); } /** * Adds to {@code errors} if this method: *