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
public class Sorter extends Ordering implements Comparator<Description>
ASorterorders tests. In general you will not need to use aSorterdirectly. Instead, useRequest.sortWith(Comparator).- Since:
- 4.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.junit.runner.manipulation.Ordering
Ordering.Context, Ordering.Factory
-
-
Constructor Summary
Constructors Constructor Description Sorter(Comparator<Description> comparator)Creates aSorterthat usescomparatorto sort tests
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapply(Object target)Sorts the tests intargetusingcomparator.intcompare(Description o1, Description o2)protected List<Description>orderItems(Collection<Description> descriptions)Implemented by sub-classes to order the descriptions.-
Methods inherited from class org.junit.runner.manipulation.Ordering
definedBy, definedBy, shuffledBy
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Field Detail
-
NULL
public static final Sorter NULL
NULL is aSorterthat leaves elements in an undefined order
-
-
Constructor Detail
-
Sorter
public Sorter(Comparator<Description> comparator)
Creates aSorterthat usescomparatorto sort tests- Parameters:
comparator- theComparatorto use when sorting tests- Since:
- 4.0
-
-
Method Detail
-
apply
public void apply(Object target)
Sorts the tests intargetusingcomparator.
-
compare
public int compare(Description o1, Description o2)
- Specified by:
comparein interfaceComparator<Description>
-
orderItems
protected final List<Description> orderItems(Collection<Description> descriptions)
Implemented by sub-classes to order the descriptions.- Specified by:
orderItemsin classOrdering- Returns:
- descriptions in order
- Since:
- 4.13
-
-