org.junit.runners.model
Class FrameworkMethod

java.lang.Object
  extended by org.junit.runners.model.FrameworkMethod

public class FrameworkMethod
extends Object

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 @Test, @Before, @After, @BeforeClass, @AfterClass, etc.)


Constructor Summary
FrameworkMethod(Method method)
          Returns a new FrameworkMethod for method
 
Method Summary
 boolean equals(Object obj)
           
<T extends Annotation>
T
getAnnotation(Class<T> annotationType)
          Returns the annotation of type annotationType on this method, if one exists.
 Annotation[] getAnnotations()
          Returns the annotations on this method
 Method getMethod()
          Returns the underlying Java method
 String getName()
          Returns the method's name
 int hashCode()
           
 Object invokeExplosively(Object target, Object... params)
          Returns the result of invoking this method on target with parameters params.
 boolean isShadowedBy(FrameworkMethod other)
           
 boolean producesType(Type type)
          Deprecated. This is used only by the Theories runner, and does not use all the generic type info that it ought to. It will be replaced with a forthcoming ParameterSignature#canAcceptResultOf(FrameworkMethod) once Theories moves to junit-contrib.
 void validateNoTypeParametersOnArgs(List<Throwable> errors)
           
 void validatePublicVoid(boolean isStatic, List<Throwable> errors)
          Adds to errors if this method: is not public, or returns something other than void, or is static (given isStatic is false), or is not static (given isStatic is true).
 void validatePublicVoidNoArg(boolean isStatic, List<Throwable> errors)
          Adds to errors if this method: is not public, or takes parameters, or returns something other than void, or is static (given isStatic is false), or is not static (given isStatic is true).
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FrameworkMethod

public FrameworkMethod(Method method)
Returns a new FrameworkMethod for method

Method Detail

getMethod

public Method getMethod()
Returns the underlying Java method


invokeExplosively

public Object invokeExplosively(Object target,
                                Object... params)
                         throws Throwable
Returns the result of invoking this method on target with parameters params. InvocationTargetExceptions thrown are unwrapped, and their causes rethrown.

Throws:
Throwable

getName

public String getName()
Returns the method's name


validatePublicVoidNoArg

public void validatePublicVoidNoArg(boolean isStatic,
                                    List<Throwable> errors)
Adds to errors if this method:

validatePublicVoid

public void validatePublicVoid(boolean isStatic,
                               List<Throwable> errors)
Adds to errors if this method:

validateNoTypeParametersOnArgs

public void validateNoTypeParametersOnArgs(List<Throwable> errors)

isShadowedBy

public boolean isShadowedBy(FrameworkMethod other)

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

producesType

@Deprecated
public boolean producesType(Type type)
Deprecated. This is used only by the Theories runner, and does not use all the generic type info that it ought to. It will be replaced with a forthcoming ParameterSignature#canAcceptResultOf(FrameworkMethod) once Theories moves to junit-contrib.

Returns true iff this is a no-arg method that returns a value assignable to type


getAnnotations

public Annotation[] getAnnotations()
Returns the annotations on this method


getAnnotation

public <T extends Annotation> T getAnnotation(Class<T> annotationType)
Returns the annotation of type annotationType on this method, if one exists.