Class MethodSource

  • All Implemented Interfaces:
    java.io.Serializable, TestSource

    @API(status=STABLE,
         since="1.0")
    public class MethodSource
    extends java.lang.Object
    implements TestSource
    Java method based TestSource.

    This class stores the method name along with its parameter types because Method does not implement Serializable.

    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​(java.lang.Object o)  
      static MethodSource from​(java.lang.reflect.Method method)
      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 and method name.
      static MethodSource from​(java.lang.String className, java.lang.String methodName, java.lang.String methodParameterTypes)
      Create a new MethodSource using the supplied class and method name.
      java.lang.String getClassName()
      Get the declaring 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()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • from

        public static MethodSource from​(java.lang.String className,
                                        java.lang.String methodName)
        Create a new MethodSource using the supplied class and method name.
        Parameters:
        className - the Class name; must not be null or blank
        methodName - the Method name; must not be null or blank
      • from

        public static MethodSource from​(java.lang.String className,
                                        java.lang.String methodName,
                                        java.lang.String methodParameterTypes)
        Create a new MethodSource using the supplied class and method name.
        Parameters:
        className - the Class name; must not be null or blank
        methodName - the Method name; must not be null or blank
        methodParameterTypes - the Method parameter types as string
      • from

        public static MethodSource from​(java.lang.reflect.Method method)
        Create a new MethodSource using the supplied method.
        Parameters:
        method - the Java method; must not be null
      • getClassName

        public java.lang.String getClassName()
        Get the declaring 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 class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object