|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.junit.runner.manipulation.Ordering
public abstract class Ordering
Reorders tests. An 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)
.
Nested Class Summary | |
---|---|
static class |
Ordering.Context
Context about the ordering being applied. |
static interface |
Ordering.Factory
Factory for creating Ordering instances. |
Constructor Summary | |
---|---|
Ordering()
|
Method Summary | |
---|---|
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)
Creates an Ordering that shuffles the items using the given
Random instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Ordering()
Method Detail |
---|
public static Ordering shuffledBy(Random random)
Ordering
that shuffles the items using the given
Random
instance.
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)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |