Module org.junit.platform.engine
Class MethodSource
- java.lang.Object
-
- org.junit.platform.engine.support.descriptor.MethodSource
-
- All Implemented Interfaces:
Serializable,TestSource
@API(status=STABLE, since="1.0") public class MethodSource extends Object implements TestSource
Method basedTestSource.This class stores the method name along with the names of its parameter types because
Methoddoes not implementSerializable.- Since:
- 1.0
- See Also:
MethodSelector, Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)static MethodSourcefrom(Class<?> testClass, Method testMethod)static MethodSourcefrom(Method testMethod)Create a newMethodSourceusing the suppliedmethod.static MethodSourcefrom(String className, String methodName)Create a newMethodSourceusing the supplied class name and method name.static MethodSourcefrom(String className, String methodName, Class<?>... methodParameterTypes)Create a newMethodSourceusing the supplied class name, method name, and method parameter types.static MethodSourcefrom(String className, String methodName, String methodParameterTypes)Create a newMethodSourceusing the supplied class name, method name, and method parameter types.StringgetClassName()Get the class name of this source.Class<?>getJavaClass()Get the Java class of this source.MethodgetJavaMethod()Get the Java method of this source.StringgetMethodName()Get the method name of this source.StringgetMethodParameterTypes()Get the method parameter types of this source.inthashCode()StringtoString()
-
-
-
Method Detail
-
from
public static MethodSource from(String className, String methodName)
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
public static MethodSource from(String className, String methodName, String 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 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
public static MethodSource from(Method testMethod)
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
public String getClassName()
Get the class name of this source.
-
getMethodName
public final String getMethodName()
Get the method name of this source.
-
getMethodParameterTypes
public final String getMethodParameterTypes()
Get the method parameter types of this source.
-
getJavaClass
@API(status=STABLE, since="1.7") public final Class<?> 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
@API(status=STABLE, since="1.7") public final Method 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()
-
-