All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.testng.internal.TestMethodComparator Maven / Gradle / Ivy

There is a newer version: 7.10.2
Show newest version
package org.testng.internal;

import java.util.Comparator;
import org.testng.ITestNGMethod;

public class TestMethodComparator implements Comparator {

  @Override
  public int compare(ITestNGMethod o1, ITestNGMethod o2) {
    return compareStatic(o1, o2);
  }

  public static int compareStatic(ITestNGMethod o1, ITestNGMethod o2) {
    int prePriDiff = Integer.compare(o1.getInterceptedPriority(), o2.getInterceptedPriority());
    if (prePriDiff != 0) {
      return prePriDiff;
    }

    int priDiff = Integer.compare(o1.getPriority(), o2.getPriority());
    if (priDiff != 0) {
      return priDiff;
    }

    return o1.getMethodName().compareTo(o2.getMethodName());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy