Class MethodOrderer.Default
- All Implemented Interfaces:
MethodOrderer
- Enclosing interface:
MethodOrderer
MethodOrderer
that allows to explicitly specify that the default
ordering should be applied.
If the "junit.jupiter.testmethod.order.default" is set, specifying this
MethodOrderer
has the same effect as referencing the configured
class directly. Otherwise, it has the same effect as not specifying any
MethodOrderer
.
This class can be used to reset the MethodOrderer
for a
@Nested
class and its @Nested
inner classes,
recursively, when a MethodOrderer
is configured using
@TestMethodOrder
on an enclosing class.
- Since:
- 6.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.junit.jupiter.api.MethodOrderer
MethodOrderer.Default, MethodOrderer.DisplayName, MethodOrderer.MethodName, MethodOrderer.OrderAnnotation, MethodOrderer.Random
-
Field Summary
Fields inherited from interface org.junit.jupiter.api.MethodOrderer
DEFAULT_ORDER_PROPERTY_NAME
-
Method Summary
Modifier and TypeMethodDescriptionvoid
orderMethods
(MethodOrdererContext context) Order the methods encapsulated in the suppliedMethodOrdererContext
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.junit.jupiter.api.MethodOrderer
getDefaultExecutionMode
-
Method Details
-
orderMethods
Description copied from interface:MethodOrderer
Order the methods encapsulated in the suppliedMethodOrdererContext
.The methods to order or sort are made indirectly available via
MethodOrdererContext.getMethodDescriptors()
. Since this method has avoid
return type, the list of method descriptors must be modified directly.For example, a simplified implementation of the
MethodOrderer.Random
MethodOrderer
might look like the following.public void orderMethods(MethodOrdererContext context) { Collections.shuffle(context.getMethodDescriptors()); }
- Specified by:
orderMethods
in interfaceMethodOrderer
- Parameters:
context
- theMethodOrdererContext
containing the method descriptors to order; nevernull
- See Also:
-