Module org.junit.platform.engine
Class MethodSource
java.lang.Object
org.junit.platform.engine.support.descriptor.MethodSource
- All Implemented Interfaces:
Serializable,TestSource
Method based
TestSource.
This class stores the method name along with the names of its parameter
types because Method does not implement Serializable.
- Since:
- 1.0
- See Also:
MethodSelector, Serialized Form
-
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic MethodSourcestatic MethodSourceCreate a newMethodSourceusing the suppliedmethod.static MethodSourceCreate a newMethodSourceusing the supplied class name and method name.static MethodSourceCreate a newMethodSourceusing the supplied class name, method name, and method parameter types.static MethodSourceCreate a newMethodSourceusing the supplied class name, method name, and method parameter types.Get the class name of this source.Class<?>Get the Java class of this source.Get the Java method of this source.Get the method name of this source.Get the method parameter types of this source.inthashCode()toString()
-
Method Details
-
from
Create a newMethodSourceusing the supplied class name and method name.- Parameters:
className- the class name; must not benullor blankmethodName- the method name; must not benullor blank
-
from
Create a newMethodSourceusing the supplied class name, method name, and method parameter types.- Parameters:
className- the class name; must not benullor blankmethodName- the method name; must not benullor blankmethodParameterTypes- a comma-separated list of fully qualified class names representing the method parameter types
-
from
@API(status=STABLE, since="1.5") public static MethodSource from(String className, String methodName, Class<?>... methodParameterTypes)Create a newMethodSourceusing the supplied class name, method name, and method parameter types.- Parameters:
className- the class name; must not benullor blankmethodName- the method name; must not benullor blankmethodParameterTypes- a varargs array of classes representing the method parameter types- Since:
- 1.5
-
from
Create a newMethodSourceusing the suppliedmethod.- Parameters:
testMethod- the Java method; must not benull- See Also:
from(Class, Method)
-
from
@API(status=STABLE, since="1.3") public static MethodSource from(Class<?> testClass, Method testMethod)Create a newMethodSourceusing the suppliedclassandmethod.This method should be used in favor of
from(Method)if the test method is inherited from a superclass or present as an interfacedefaultmethod.- Parameters:
testClass- the Java class; must not benulltestMethod- the Java method; must not benull- Since:
- 1.3
-
getClassName
Get the class name of this source. -
getMethodName
Get the method name of this source. -
getMethodParameterTypes
Get the method parameter types of this source. -
getJavaClass
Get the Java class of this source.If the
Classwas not provided, but only the name, this method attempts to lazily load theClassbased on its name and throws aPreconditionViolationExceptionif the class cannot be loaded.- Since:
- 1.7
- See Also:
getClassName()
-
getJavaMethod
Get the Java method of this source.If the
Methodwas not provided, but only the name, this method attempts to lazily load theMethodbased on its name and throws aPreconditionViolationExceptionif the method cannot be loaded.- Since:
- 1.7
- See Also:
getMethodName()
-
equals
-
hashCode
public int hashCode() -
toString
-