Class WrappedTestNGMethod

  • All Implemented Interfaces:
    java.lang.Cloneable, ITestNGMethod

    public class WrappedTestNGMethod
    extends java.lang.Object
    implements ITestNGMethod
    Represents a proxy for an actual instance of ITestNGMethod but with the exception that it generates a unique hashcode that is different from the original ITestNGMethod instance that it wraps.
    • Constructor Detail

      • WrappedTestNGMethod

        public WrappedTestNGMethod​(ITestNGMethod testNGMethod)
    • Method Detail

      • getRealClass

        public java.lang.Class<?> getRealClass()
        Specified by:
        getRealClass in interface ITestNGMethod
        Returns:
        The real class on which this method was declared (can be different from getMethod().getDeclaringClass() if the test method was defined in a superclass).
      • setTestClass

        public void setTestClass​(ITestClass cls)
        Description copied from interface: ITestNGMethod
        Sets the test class having this method. This is not necessarily the declaring class.
        Specified by:
        setTestClass in interface ITestNGMethod
        Parameters:
        cls - The test class having this method.
      • getMethod

        public java.lang.reflect.Method getMethod()
        Specified by:
        getMethod in interface ITestNGMethod
        Returns:
        the corresponding Java test method.
      • getMethodName

        public java.lang.String getMethodName()
        Description copied from interface: ITestNGMethod
        Returns the method name. This is needed for serialization because methods are not Serializable.
        Specified by:
        getMethodName in interface ITestNGMethod
        Returns:
        the method name.
      • getInstances

        public java.lang.Object[] getInstances()
        Specified by:
        getInstances in interface ITestNGMethod
        Returns:
        All the instances the methods will be invoked upon. This will typically be an array of one object in the absence of an @Factory annotation.
      • getGroups

        public java.lang.String[] getGroups()
        Specified by:
        getGroups in interface ITestNGMethod
        Returns:
        The groups this method belongs to, possibly added to the groups declared on the class.
      • getGroupsDependedUpon

        public java.lang.String[] getGroupsDependedUpon()
        Specified by:
        getGroupsDependedUpon in interface ITestNGMethod
        Returns:
        The groups this method depends on, possibly added to the groups declared on the class.
      • getMethodsDependedUpon

        public java.lang.String[] getMethodsDependedUpon()
        Specified by:
        getMethodsDependedUpon in interface ITestNGMethod
        Returns:
        The methods this method depends on, possibly added to the methods declared on the class.
      • isTest

        public boolean isTest()
        Specified by:
        isTest in interface ITestNGMethod
        Returns:
        true if this method was annotated with @Test
      • isBeforeMethodConfiguration

        public boolean isBeforeMethodConfiguration()
        Specified by:
        isBeforeMethodConfiguration in interface ITestNGMethod
        Returns:
        true if this method was annotated with @Configuration and beforeTestMethod = true
      • isAfterMethodConfiguration

        public boolean isAfterMethodConfiguration()
        Specified by:
        isAfterMethodConfiguration in interface ITestNGMethod
        Returns:
        true if this method was annotated with @Configuration and beforeTestMethod = false
      • isBeforeClassConfiguration

        public boolean isBeforeClassConfiguration()
        Specified by:
        isBeforeClassConfiguration in interface ITestNGMethod
        Returns:
        true if this method was annotated with @Configuration and beforeClassMethod = true
      • isAfterClassConfiguration

        public boolean isAfterClassConfiguration()
        Specified by:
        isAfterClassConfiguration in interface ITestNGMethod
        Returns:
        true if this method was annotated with @Configuration and beforeClassMethod = false
      • isBeforeSuiteConfiguration

        public boolean isBeforeSuiteConfiguration()
        Specified by:
        isBeforeSuiteConfiguration in interface ITestNGMethod
        Returns:
        true if this method was annotated with @Configuration and beforeSuite = true
      • isAfterSuiteConfiguration

        public boolean isAfterSuiteConfiguration()
        Specified by:
        isAfterSuiteConfiguration in interface ITestNGMethod
        Returns:
        true if this method was annotated with @Configuration and afterSuite = true
      • isBeforeTestConfiguration

        public boolean isBeforeTestConfiguration()
        Specified by:
        isBeforeTestConfiguration in interface ITestNGMethod
        Returns:
        true if this method is a @BeforeTest (@Configuration beforeTest=true)
      • isAfterTestConfiguration

        public boolean isAfterTestConfiguration()
        Specified by:
        isAfterTestConfiguration in interface ITestNGMethod
        Returns:
        true if this method is an @AfterTest (@Configuration afterTest=true)
      • getTimeOut

        public long getTimeOut()
        Specified by:
        getTimeOut in interface ITestNGMethod
        Returns:
        The timeout in milliseconds.
      • getInvocationCount

        public int getInvocationCount()
        Specified by:
        getInvocationCount in interface ITestNGMethod
        Returns:
        the number of times this method needs to be invoked.
      • getSuccessPercentage

        public int getSuccessPercentage()
        Specified by:
        getSuccessPercentage in interface ITestNGMethod
        Returns:
        the success percentage for this method (between 0 and 100).
      • getId

        public java.lang.String getId()
        Specified by:
        getId in interface ITestNGMethod
        Returns:
        The id of the thread this method was run in.
      • setId

        public void setId​(java.lang.String id)
        Specified by:
        setId in interface ITestNGMethod
      • canRunFromClass

        public boolean canRunFromClass​(IClass testClass)
        Description copied from interface: ITestNGMethod
        Returns if this ITestNGMethod can be invoked from within IClass.
        Specified by:
        canRunFromClass in interface ITestNGMethod
      • isAlwaysRun

        public boolean isAlwaysRun()
        Specified by:
        isAlwaysRun in interface ITestNGMethod
        Returns:
        true if this method is alwaysRun=true
      • getThreadPoolSize

        public int getThreadPoolSize()
        Specified by:
        getThreadPoolSize in interface ITestNGMethod
        Returns:
        the number of threads to be used when invoking the method on parallel
      • setDescription

        public void setDescription​(java.lang.String description)
        Specified by:
        setDescription in interface ITestNGMethod
      • setMoreInvocationChecker

        public void setMoreInvocationChecker​(java.util.concurrent.Callable<java.lang.Boolean> moreInvocationChecker)
        Specified by:
        setMoreInvocationChecker in interface ITestNGMethod
      • getInvocationTimeOut

        public long getInvocationTimeOut()
        Description copied from interface: ITestNGMethod
        The time under which all invocationCount methods need to complete by.
        Specified by:
        getInvocationTimeOut in interface ITestNGMethod
      • getInvocationNumbers

        public java.util.List<java.lang.Integer> getInvocationNumbers()
        Description copied from interface: ITestNGMethod
        Which invocation numbers of this method should be used (only applicable if it uses a data provider). If this value is an empty list, use all the values returned from the data provider. These values are read from the XML file in the tag.
        Specified by:
        getInvocationNumbers in interface ITestNGMethod
      • setInvocationNumbers

        public void setInvocationNumbers​(java.util.List<java.lang.Integer> numbers)
        Specified by:
        setInvocationNumbers in interface ITestNGMethod
      • addFailedInvocationNumber

        public void addFailedInvocationNumber​(int number)
        Description copied from interface: ITestNGMethod
        The list of invocation numbers that failed, which is only applicable for methods that have a data provider.
        Specified by:
        addFailedInvocationNumber in interface ITestNGMethod
      • getPriority

        public int getPriority()
        Description copied from interface: ITestNGMethod
        The scheduling priority. Lower priorities get scheduled first.
        Specified by:
        getPriority in interface ITestNGMethod
      • findMethodParameters

        public java.util.Map<java.lang.String,​java.lang.String> findMethodParameters​(XmlTest test)
        Specified by:
        findMethodParameters in interface ITestNGMethod
        Returns:
        the parameters found in the include tag, if any
      • getQualifiedName

        public java.lang.String getQualifiedName()
        Description copied from interface: ITestNGMethod
        getRealClass().getName() + "." + getMethodName()
        Specified by:
        getQualifiedName in interface ITestNGMethod
        Returns:
        qualified name for this method
      • 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