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
Method
does 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 boolean
equals(Object o)
static MethodSource
from(Class<?> testClass, Method testMethod)
static MethodSource
from(Method testMethod)
Create a newMethodSource
using the suppliedmethod
.static MethodSource
from(String className, String methodName)
Create a newMethodSource
using the supplied class name and method name.static MethodSource
from(String className, String methodName, String methodParameterTypes)
Create a newMethodSource
using the supplied class name, method name, and method parameter types.String
getClassName()
Get the class name of this source.String
getMethodName()
Get the method name of this source.String
getMethodParameterTypes()
Get the method parameter types of this source.int
hashCode()
String
toString()
-
-
-
Method Detail
-
from
public static MethodSource from(String className, String methodName)
Create a newMethodSource
using the supplied class name and method name.- Parameters:
className
- the class name; must not benull
or blankmethodName
- the method name; must not benull
or blank
-
from
public static MethodSource from(String className, String methodName, String methodParameterTypes)
Create a newMethodSource
using the supplied class name, method name, and method parameter types.- Parameters:
className
- the class name; must not benull
or blankmethodName
- the method name; must not benull
or blankmethodParameterTypes
- the method parameter types as a string
-
from
public static MethodSource from(Method testMethod)
Create a newMethodSource
using 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 newMethodSource
using the suppliedclass
andmethod
.This method should be used in favor of
from(Method)
if the test method is inherited from a superclass or present as an interfacedefault
method.- Parameters:
testClass
- the Java class; must not benull
testMethod
- 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.
-
-