Class MethodSource

    • Method Detail

      • from

        public static MethodSource from​(String className,
                                        String methodName)
        Create a new MethodSource using the supplied class name 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​(String className,
                                        String methodName,
                                        String methodParameterTypes)
        Create a new MethodSource using the supplied class name, method name, and method parameter types.
        Parameters:
        className - the class name; must not be null or blank
        methodName - the method name; must not be null or blank
        methodParameterTypes - 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 new MethodSource using the supplied class name, method name, and method parameter types.
        Parameters:
        className - the class name; must not be null or blank
        methodName - the method name; must not be null or blank
        methodParameterTypes - a varargs array of classes representing the method parameter types
        Since:
        1.5
      • from

        @API(status=STABLE,
             since="1.3")
        public static MethodSource from​(Class<?> testClass,
                                        Method testMethod)
        Create a new 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.

        Parameters:
        testClass - the Java class; must not be null
        testMethod - the Java method; must not be null
        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 Class was not provided, but only the name, this method attempts to lazily load the Class based on its name and throws a PreconditionViolationException if 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 Method was not provided, but only the name, this method attempts to lazily load the Method based on its name and throws a PreconditionViolationException if the method cannot be loaded.

        Since:
        1.7
        See Also:
        getMethodName()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object