Class MethodSource
- java.lang.Object
-
- org.junit.platform.engine.support.descriptor.MethodSource
-
- All Implemented Interfaces:
java.io.Serializable
,TestSource
@API(status=STABLE, since="1.0") public class MethodSource extends java.lang.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
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
className
private java.lang.String
methodName
private java.lang.String
methodParameterTypes
private static long
serialVersionUID
-
Constructor Summary
Constructors Modifier Constructor Description private
MethodSource(java.lang.Class<?> testClass, java.lang.reflect.Method testMethod)
private
MethodSource(java.lang.reflect.Method testMethod)
private
MethodSource(java.lang.String className, java.lang.String methodName)
private
MethodSource(java.lang.String className, java.lang.String methodName, java.lang.String methodParameterTypes)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
static MethodSource
from(java.lang.Class<?> testClass, java.lang.reflect.Method testMethod)
Create a newMethodSource
using the suppliedclass
andmethod
.static MethodSource
from(java.lang.reflect.Method testMethod)
Create a newMethodSource
using the suppliedmethod
.static MethodSource
from(java.lang.String className, java.lang.String methodName)
Create a newMethodSource
using the supplied class name and method name.static MethodSource
from(java.lang.String className, java.lang.String methodName, java.lang.Class<?>... methodParameterTypes)
Create a newMethodSource
using the supplied class name, method name, and method parameter types.static MethodSource
from(java.lang.String className, java.lang.String methodName, java.lang.String methodParameterTypes)
Create a newMethodSource
using the supplied class name, method name, and method parameter types.java.lang.String
getClassName()
Get the class name of this source.java.lang.String
getMethodName()
Get the method name of this source.java.lang.String
getMethodParameterTypes()
Get the method parameter types of this source.int
hashCode()
java.lang.String
toString()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
className
private final java.lang.String className
-
methodName
private final java.lang.String methodName
-
methodParameterTypes
private final java.lang.String methodParameterTypes
-
-
Constructor Detail
-
MethodSource
private MethodSource(java.lang.String className, java.lang.String methodName)
-
MethodSource
private MethodSource(java.lang.String className, java.lang.String methodName, java.lang.String methodParameterTypes)
-
MethodSource
private MethodSource(java.lang.reflect.Method testMethod)
-
MethodSource
private MethodSource(java.lang.Class<?> testClass, java.lang.reflect.Method testMethod)
- Since:
- 1.3
-
-
Method Detail
-
from
public static MethodSource from(java.lang.String className, java.lang.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(java.lang.String className, java.lang.String methodName, java.lang.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
- 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(java.lang.String className, java.lang.String methodName, java.lang.Class<?>... 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
- a varargs array of classes representing the method parameter types- Since:
- 1.5
-
from
public static MethodSource from(java.lang.reflect.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(java.lang.Class<?> testClass, java.lang.reflect.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 java.lang.String getClassName()
Get the class name of this source.
-
getMethodName
public final java.lang.String getMethodName()
Get the method name of this source.
-
getMethodParameterTypes
public final java.lang.String getMethodParameterTypes()
Get the method parameter types of this source.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-