Package org.junit.runners.model
Class FrameworkMethod
- All Implemented Interfaces:
Annotatable
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.)- Since:
- 4.5
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
<T extends Annotation>
TgetAnnotation
(Class<T> annotationType) Returns the annotation of typeannotationType
on this method, if one exists.Returns the annotations on this methodClass<?>
Returns the class where the method is actually declaredReturns the underlying Java methodprotected int
getName()
Returns the method's nameprivate Class<?>[]
Class<?>
Returns the return type of the methodClass<?>
getType()
Returns the return type of the methodint
hashCode()
invokeExplosively
(Object target, Object... params) Returns the result of invoking this method ontarget
with parametersparams
.(package private) boolean
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.toString()
void
validateNoTypeParametersOnArgs
(List<Throwable> errors) void
validatePublicVoid
(boolean isStatic, List<Throwable> errors) Adds toerrors
if this method: is not public, or returns something other than void, or is static (givenisStatic is false
), or is not static (givenisStatic is true
).void
validatePublicVoidNoArg
(boolean isStatic, List<Throwable> errors) Adds toerrors
if this method: is not public, or takes parameters, or returns something other than void, or is static (givenisStatic is false
), or is not static (givenisStatic is true
).Methods inherited from class org.junit.runners.model.FrameworkMember
handlePossibleBridgeMethod, isPublic, isStatic
-
Field Details
-
method
-
-
Constructor Details
-
FrameworkMethod
Returns a newFrameworkMethod
formethod
-
-
Method Details
-
getMethod
Returns the underlying Java method -
invokeExplosively
Returns the result of invoking this method ontarget
with parametersparams
.InvocationTargetException
s thrown are unwrapped, and their causes rethrown.- Throws:
Throwable
-
getName
Returns the method's name- Specified by:
getName
in classFrameworkMember<FrameworkMethod>
-
validatePublicVoidNoArg
Adds toerrors
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
).
-
validatePublicVoid
Adds toerrors
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
).
-
getModifiers
protected int getModifiers()- Specified by:
getModifiers
in classFrameworkMember<FrameworkMethod>
-
getReturnType
Returns the return type of the method -
getType
Returns the return type of the method- Specified by:
getType
in classFrameworkMember<FrameworkMethod>
-
getDeclaringClass
Returns the class where the method is actually declared- Specified by:
getDeclaringClass
in classFrameworkMember<FrameworkMethod>
-
validateNoTypeParametersOnArgs
-
isShadowedBy
- Specified by:
isShadowedBy
in classFrameworkMember<FrameworkMethod>
-
isBridgeMethod
boolean isBridgeMethod()- Specified by:
isBridgeMethod
in classFrameworkMember<FrameworkMethod>
-
equals
-
hashCode
public int hashCode() -
producesType
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 if this is a no-arg method that returns a value assignable totype
-
getParameterTypes
-
getAnnotations
Returns the annotations on this method -
getAnnotation
Returns the annotation of typeannotationType
on this method, if one exists. -
toString
-