public class Sorter extends Ordering implements java.util.Comparator<Description>
Sorter orders tests. In general you will not need
to use a Sorter directly. Instead, use
Request.sortWith(Comparator).Ordering.Context, Ordering.Factory| Modifier and Type | Field and Description |
|---|---|
private java.util.Comparator<Description> |
comparator |
static Sorter |
NULL
NULL is a
Sorter that leaves elements in an undefined order |
| Constructor and Description |
|---|
Sorter(java.util.Comparator<Description> comparator)
Creates a
Sorter that uses comparator
to sort tests |
| Modifier and Type | Method and Description |
|---|---|
void |
apply(java.lang.Object target)
Sorts the tests in
target using comparator. |
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.
|
(package private) boolean |
validateOrderingIsCorrect()
Returns
true if this ordering could produce invalid results (i.e. |
definedBy, definedBy, shuffledBypublic static final Sorter NULL
Sorter that leaves elements in an undefined orderprivate final java.util.Comparator<Description> comparator
public Sorter(java.util.Comparator<Description> comparator)
Sorter that uses comparator
to sort testscomparator - the Comparator to use when sorting testspublic void apply(java.lang.Object target)
target using comparator.public int compare(Description o1, Description o2)
compare in interface java.util.Comparator<Description>protected final java.util.List<Description> orderItems(java.util.Collection<Description> descriptions)
orderItems in class Orderingboolean validateOrderingIsCorrect()
true if this ordering could produce invalid results (i.e.
if it could add or remove values).validateOrderingIsCorrect in class Ordering