Package org.junit.runner.manipulation
Class Sorter
java.lang.Object
org.junit.runner.manipulation.Ordering
org.junit.runner.manipulation.Sorter
- All Implemented Interfaces:
Comparator<Description>
- Direct Known Subclasses:
Alphanumeric
A
Sorter orders tests. In general you will not need
to use a Sorter directly. Instead, use
Request.sortWith(Comparator).- Since:
- 4.0
-
Nested Class Summary
Nested classes/interfaces inherited from class org.junit.runner.manipulation.Ordering
Ordering.Context, Ordering.Factory -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Comparator<Description> static final SorterNULL is aSorterthat leaves elements in an undefined order -
Constructor Summary
ConstructorsConstructorDescriptionSorter(Comparator<Description> comparator) Creates aSorterthat usescomparatorto sort tests -
Method Summary
Modifier and TypeMethodDescriptionvoidSorts the tests intargetusingcomparator.intcompare(Description o1, Description o2) protected final List<Description> orderItems(Collection<Description> descriptions) Implemented by sub-classes to order the descriptions.(package private) booleanReturnstrueif this ordering could produce invalid results (i.e.Methods inherited from class org.junit.runner.manipulation.Ordering
definedBy, definedBy, shuffledByMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
NULL
NULL is aSorterthat leaves elements in an undefined order -
comparator
-
-
Constructor Details
-
Sorter
Creates aSorterthat usescomparatorto sort tests- Parameters:
comparator- theComparatorto use when sorting tests- Since:
- 4.0
-
-
Method Details
-
apply
Sorts the tests intargetusingcomparator. -
compare
- Specified by:
comparein interfaceComparator<Description>
-
orderItems
Implemented by sub-classes to order the descriptions.- Specified by:
orderItemsin classOrdering- Returns:
- descriptions in order
- Since:
- 4.13
-
validateOrderingIsCorrect
boolean validateOrderingIsCorrect()Returnstrueif this ordering could produce invalid results (i.e. if it could add or remove values).- Overrides:
validateOrderingIsCorrectin classOrdering- Since:
- 4.13
-