Class MethodOrderer.Default
java.lang.Object
org.junit.jupiter.api.MethodOrderer.Default
- All Implemented Interfaces:
MethodOrderer
- Enclosing interface:
MethodOrderer
@API(status=EXPERIMENTAL,
since="6.0")
public static final class MethodOrderer.Default
extends Object
implements 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 MethodOrderer
MethodOrderer.Default, MethodOrderer.DisplayName, MethodOrderer.MethodName, MethodOrderer.OrderAnnotation, MethodOrderer.Random -
Field Summary
Fields inherited from interface MethodOrderer
DEFAULT_ORDER_PROPERTY_NAME -
Method Summary
Modifier and TypeMethodDescriptionvoidorderMethods(MethodOrdererContext context) Order the methods encapsulated in the suppliedMethodOrdererContext.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface MethodOrderer
getDefaultExecutionMode
-
Method Details
-
orderMethods
Description copied from interface:MethodOrdererOrder the methods encapsulated in the suppliedMethodOrdererContext.The methods to order or sort are made indirectly available via
MethodOrdererContext.getMethodDescriptors(). Since this method has avoidreturn type, the list of method descriptors must be modified directly.For example, a simplified implementation of the
MethodOrderer.RandomMethodOrderermight look like the following.public void orderMethods(MethodOrdererContext context) { Collections.shuffle(context.getMethodDescriptors()); }- Specified by:
orderMethodsin interfaceMethodOrderer- Parameters:
context- theMethodOrdererContextcontaining the method descriptors to order; nevernull- See Also:
-