Class ClassOrderer.Random
- java.lang.Object
-
- org.junit.jupiter.api.ClassOrderer.Random
-
- All Implemented Interfaces:
ClassOrderer
- Enclosing interface:
- ClassOrderer
public static class ClassOrderer.Random extends Object implements 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 initialization of this class. In order to support repeatable builds, the value of the default random seed is logged atCONFIG
level. In addition, a custom seed (potentially the default seed from the previous test plan execution) may be specified via thejunit.jupiter.execution.order.random.seed
configuration parameter which can be supplied via theLauncher
API, build tools (e.g., Gradle and Maven), a JVM system property, or the JUnit Platform configuration file (i.e., a file namedjunit-platform.properties
in the root of the class path). Consult the User Guide for further information.- See Also:
RANDOM_SEED_PROPERTY_NAME
,Random
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.junit.jupiter.api.ClassOrderer
ClassOrderer.ClassName, ClassOrderer.DisplayName, ClassOrderer.OrderAnnotation, ClassOrderer.Random
-
-
Field Summary
Fields Modifier and Type Field Description static String
RANDOM_SEED_PROPERTY_NAME
Property name used to set the random seed used by thisClassOrderer
: "junit.jupiter.execution.order.random.seed"
-
Constructor Summary
Constructors Constructor Description Random()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
orderClasses(ClassOrdererContext context)
Order the classes encapsulated in the suppliedClassOrdererContext
pseudo-randomly.
-
-
-
Field Detail
-
RANDOM_SEED_PROPERTY_NAME
public static final String 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.Random
for consistency between the two random orderers.Supported Values
Supported values include any string that can be converted to a
Long
viaLong.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:
MethodOrderer.Random
, Constant Field Values
-
-
Method Detail
-
orderClasses
public void orderClasses(ClassOrdererContext context)
Order the classes encapsulated in the suppliedClassOrdererContext
pseudo-randomly.- Specified by:
orderClasses
in interfaceClassOrderer
- Parameters:
context
- theClassOrdererContext
containing the class descriptors to order; nevernull
-
-