1 package org.testng.internal;
2 
3 import org.testng.IMethodSelector;
4 import org.testng.ITestNGMethod;
5 
6 import java.util.List;
7 
8 /**
9  * This class describes a method selector:
10  * - The class that implements it
11  * - Its priority
12  *
13  * Created on Sep 26, 2005
14  * @author cbeust
15  */
16 public class MethodSelectorDescriptor implements Comparable<MethodSelectorDescriptor> {
17   private IMethodSelector m_methodSelector;
18   private int m_priority;
19 
getPriority()20   public int getPriority() {
21     return m_priority;
22   }
23 
getMethodSelector()24   public IMethodSelector getMethodSelector() {
25     return m_methodSelector;
26   }
27 
MethodSelectorDescriptor(IMethodSelector selector, int priority)28   public MethodSelectorDescriptor(IMethodSelector selector, int priority) {
29     m_methodSelector = selector;
30     m_priority = priority;
31   }
32 
33   @Override
compareTo(MethodSelectorDescriptor other)34   public int compareTo(MethodSelectorDescriptor other) {
35     int result = 0;
36 
37     try {
38       int p1 = getPriority();
39       int p2 = other.getPriority();
40       result = p1 - p2;
41     }
42     catch(Exception ex) {
43       // ignore
44     }
45 
46     return result;
47   }
48 
setTestMethods(List<ITestNGMethod> testMethods)49   public void setTestMethods(List<ITestNGMethod> testMethods) {
50     m_methodSelector.setTestMethods(testMethods);
51 
52   }
53 }
54