Class ClassOrderer.Random
- All Implemented Interfaces:
ClassOrderer
- Enclosing interface:
ClassOrderer
ClassOrderer that orders classes pseudo-randomly.
Custom Seed
By default, the random seed used for ordering classes is the
value returned by System.nanoTime() during static class
initialization. In order to support repeatable builds, the value of the
random seed in use is logged at CONFIG level. A custom seed
(potentially the default seed from the previous test plan execution) may
be specified via the "junit.jupiter.execution.order.random.seed"
configuration parameter which can be supplied via the
Launcher API, build tools (e.g., Gradle and Maven), a JVM system
property, or the JUnit Platform configuration file (i.e., a file named
junit-platform.properties in the root of the class path). Consult
the User Guide for further information.
- Since:
- 5.8
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface ClassOrderer
ClassOrderer.ClassName, ClassOrderer.Default, ClassOrderer.DisplayName, ClassOrderer.OrderAnnotation, ClassOrderer.Random -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringProperty name used to set the random seed used by thisClassOrderer: "junit.jupiter.execution.order.random.seed"Fields inherited from interface ClassOrderer
DEFAULT_ORDER_PROPERTY_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidorderClasses(ClassOrdererContext context) Order the classes encapsulated in the suppliedClassOrdererContextpseudo-randomly.
-
Field Details
-
RANDOM_SEED_PROPERTY_NAME
Property name used to set the random seed used by thisClassOrderer: "junit.jupiter.execution.order.random.seed"The same property is used by
MethodOrderer.Randomfor consistency between the two random orderers.Supported Values
Supported values include any string that can be converted to a
LongviaLong.valueOf(String).If not specified or if the specified value cannot be converted to a
Long, the default random seed will be used (see the class-level Javadoc for details).- See Also:
-
-
Constructor Details
-
Random
public Random()
-
-
Method Details
-
orderClasses
Order the classes encapsulated in the suppliedClassOrdererContextpseudo-randomly.- Specified by:
orderClassesin interfaceClassOrderer- Parameters:
context- theClassOrdererContextcontaining the class descriptors to order; nevernull
-