@API(status=STABLE,
since="1.0")
public class MethodSource
extends java.lang.Object
implements TestSource
TestSource.
This class stores the method name along with the names of its parameter
types because Method does not implement Serializable.
MethodSelector,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
className |
private java.lang.String |
methodName |
private java.lang.String |
methodParameterTypes |
private static long |
serialVersionUID |
| Modifier | Constructor and 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) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object o) |
static MethodSource |
from(java.lang.Class<?> testClass,
java.lang.reflect.Method testMethod)
Create a new
MethodSource using the supplied
class and method. |
static MethodSource |
from(java.lang.reflect.Method testMethod)
Create a new
MethodSource using the supplied method. |
static MethodSource |
from(java.lang.String className,
java.lang.String methodName)
Create a new
MethodSource 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 new
MethodSource 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 new
MethodSource 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() |
private static final long serialVersionUID
private final java.lang.String className
private final java.lang.String methodName
private final java.lang.String methodParameterTypes
private MethodSource(java.lang.String className,
java.lang.String methodName)
private MethodSource(java.lang.String className,
java.lang.String methodName,
java.lang.String methodParameterTypes)
private MethodSource(java.lang.reflect.Method testMethod)
private MethodSource(java.lang.Class<?> testClass,
java.lang.reflect.Method testMethod)
public static MethodSource from(java.lang.String className, java.lang.String methodName)
MethodSource using the supplied class name and
method name.className - the class name; must not be null or blankmethodName - the method name; must not be null or blankpublic static MethodSource from(java.lang.String className, java.lang.String methodName, java.lang.String methodParameterTypes)
MethodSource using the supplied class name, method
name, and method parameter types.className - the class name; must not be null or blankmethodName - the method name; must not be null or blankmethodParameterTypes - a comma-separated list of fully qualified
class names representing the method parameter types@API(status=STABLE,
since="1.5")
public static MethodSource from(java.lang.String className,
java.lang.String methodName,
java.lang.Class<?>... methodParameterTypes)
MethodSource using the supplied class name, method
name, and method parameter types.className - the class name; must not be null or blankmethodName - the method name; must not be null or blankmethodParameterTypes - a varargs array of classes representing the
method parameter typespublic static MethodSource from(java.lang.reflect.Method testMethod)
MethodSource using the supplied method.testMethod - the Java method; must not be nullfrom(Class, Method)@API(status=STABLE,
since="1.3")
public static MethodSource from(java.lang.Class<?> testClass,
java.lang.reflect.Method testMethod)
MethodSource using the supplied
class and method.
This method should be used in favor of from(Method) if the
test method is inherited from a superclass or present as an interface
default method.
testClass - the Java class; must not be nulltestMethod - the Java method; must not be nullpublic java.lang.String getClassName()
public final java.lang.String getMethodName()
public final java.lang.String getMethodParameterTypes()
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object