holmos.webtest.junitextentions.HolmosSort Maven / Gradle / Ivy
package holmos.webtest.junitextentions;
import holmos.webtest.junitextentions.annotations.RunAfter;
import java.util.Comparator;
import org.junit.runner.Description;
/**
* 排序类
*
* @author 吴银龙([email protected])
* */
public class HolmosSort implements Comparator{
@Override
public int compare(Description o1, Description o2) {
if(o1.getAnnotation(RunAfter.class)==null)return 0;
String priorMethodOfO1=o1.getAnnotation(RunAfter.class).methodName();
if(priorMethodOfO1.equalsIgnoreCase(o2.getMethodName())){
return 1;
}
return 0;
}
}