Package org.junit.internal
Class MethodSorter
java.lang.Object
org.junit.internal.MethodSorter
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Comparator
<Method> DEFAULT sort orderstatic final Comparator
<Method> Method name ascending lexicographic sort order, withMethod.toString()
as a tiebreaker -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Method[]
getDeclaredMethods
(Class<?> clazz) Gets declared methods of a class in a predictable order, unless @FixMethodOrder(MethodSorters.JVM) is specified.private static Comparator
<Method> getSorter
(FixMethodOrder fixMethodOrder)
-
Field Details
-
DEFAULT
DEFAULT sort order -
NAME_ASCENDING
Method name ascending lexicographic sort order, withMethod.toString()
as a tiebreaker
-
-
Constructor Details
-
MethodSorter
private MethodSorter()
-
-
Method Details
-
getDeclaredMethods
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.- Parameters:
clazz
- a class- Returns:
- same as
Class.getDeclaredMethods()
but sorted - See Also:
-
getSorter
-