Package org.junit.runner.manipulation
Class Sorter
- java.lang.Object
-
- org.junit.runner.manipulation.Ordering
-
- org.junit.runner.manipulation.Sorter
-
- All Implemented Interfaces:
java.util.Comparator<Description>
- Direct Known Subclasses:
Alphanumeric
public class Sorter extends Ordering implements java.util.Comparator<Description>
ASorter
orders tests. In general you will not need to use aSorter
directly. 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(java.util.Comparator<Description> comparator)
Creates aSorter
that usescomparator
to sort tests
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
apply(java.lang.Object target)
Sorts the tests intarget
usingcomparator
.int
compare(Description o1, Description o2)
protected java.util.List<Description>
orderItems(java.util.Collection<Description> descriptions)
Implemented by sub-classes to order the descriptions.-
Methods inherited from class org.junit.runner.manipulation.Ordering
definedBy, definedBy, shuffledBy
-
-
-
-
Constructor Detail
-
Sorter
public Sorter(java.util.Comparator<Description> comparator)
Creates aSorter
that usescomparator
to sort tests- Parameters:
comparator
- theComparator
to use when sorting tests- Since:
- 4.0
-
-
Method Detail
-
apply
public void apply(java.lang.Object target)
Sorts the tests intarget
usingcomparator
.
-
compare
public int compare(Description o1, Description o2)
- Specified by:
compare
in interfacejava.util.Comparator<Description>
-
orderItems
protected final java.util.List<Description> orderItems(java.util.Collection<Description> descriptions)
Implemented by sub-classes to order the descriptions.- Specified by:
orderItems
in classOrdering
- Returns:
- descriptions in order
- Since:
- 4.13
-
-