类 MethodSorter
- java.lang.Object
- org.junit.internal.MethodSorter
public class MethodSorter extends Object
字段概要
字段 修饰符和类型 字段 说明 static Comparator<Method>
DEFAULT
DEFAULT sort orderstatic Comparator<Method>
NAME_ASCENDING
Method name ascending lexicographic sort order, withMethod.toString()
as a tiebreaker
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static Method[]
getDeclaredMethods(Class<?> clazz)
Gets declared methods of a class in a predictable order, unless @FixMethodOrder(MethodSorters.JVM) is specified.
字段详细资料
DEFAULT
public static final Comparator<Method> DEFAULT
DEFAULT sort order
NAME_ASCENDING
public static final Comparator<Method> NAME_ASCENDING
Method name ascending lexicographic sort order, withMethod.toString()
as a tiebreaker
方法详细资料
getDeclaredMethods
public static Method[] getDeclaredMethods(Class<?> clazz)
Gets declared methods of a class in a predictable order, unless @FixMethodOrder(MethodSorters.JVM) is specified. Using the JVM order is unwise since the Java platform does not specify any particular order, and in fact JDK 7 returns a more or less random order; well-written test code would not assume any order, but some does, and a predictable failure is better than a random failure on certain platforms. By default, uses an unspecified but deterministic order.- 参数:
clazz
- a class- 返回:
- same as
Class.getDeclaredMethods()
but sorted - 另请参阅:
- JDK (non-)bug #7023180