public abstract class Ordering extends Object
Ordering can reverse the order of tests, sort the
order or even shuffle the order.
In general you will not need to use a Ordering directly.
Instead, use Request.orderWith(Ordering).
| Modifier and Type | Class and Description |
|---|---|
static class |
Ordering.Context
Context about the ordering being applied.
|
static interface |
Ordering.Factory
Factory for creating
Ordering instances. |
| Constructor and Description |
|---|
Ordering() |
| Modifier and Type | Method and Description |
|---|---|
void |
apply(Object target)
Order the tests in
target using this ordering. |
static Ordering |
definedBy(Class<? extends Ordering.Factory> factoryClass,
Description annotatedTestClass)
Creates an
Ordering from the given factory class. |
static Ordering |
definedBy(Ordering.Factory factory,
Description annotatedTestClass)
Creates an
Ordering from the given factory. |
protected abstract List<Description> |
orderItems(Collection<Description> descriptions)
Implemented by sub-classes to order the descriptions.
|
static Ordering |
shuffledBy(Random random)
|
public Ordering()
public static Ordering shuffledBy(Random random)
public static Ordering definedBy(Class<? extends Ordering.Factory> factoryClass, Description annotatedTestClass) throws InvalidOrderingException
Ordering from the given factory class. The class must have a public no-arg
constructor.factoryClass - class to use to create the orderingannotatedTestClass - test class that is annotated with OrderWith.InvalidOrderingException - if the instance could not be createdpublic static Ordering definedBy(Ordering.Factory factory, Description annotatedTestClass) throws InvalidOrderingException
Ordering from the given factory.factory - factory to use to create the orderingannotatedTestClass - test class that is annotated with OrderWith.InvalidOrderingException - if the instance could not be createdpublic void apply(Object target) throws InvalidOrderingException
target using this ordering.InvalidOrderingException - if ordering does something invalid (like remove or add
children)protected abstract List<Description> orderItems(Collection<Description> descriptions)
Copyright © 2002–2020 JUnit. All rights reserved.