Interface ConfigurationParameters
- All Known Implementing Classes:
PrefixedConfigurationParameters
TestEngines may use to
influence test discovery and execution.
For example, the JUnit Jupiter engine uses a configuration parameter to enable IDEs and build tools to deactivate conditional test execution.
As of JUnit Platform 1.8, configuration parameters are also made available to
implementations of the TestExecutionListener
API via the TestPlan.
- Since:
- 1.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringName of the JUnit Platform configuration file: "junit-platform.properties". -
Method Summary
Modifier and TypeMethodDescriptionGet the configuration parameter stored under the specifiedkey.default <T> Optional<T> Get and transform the configuration parameter stored under the specifiedkeyusing the specifiedtransformer.getBoolean(String key) Get the boolean configuration parameter stored under the specifiedkey.keySet()Get the keys of all configuration parameters stored in thisConfigurationParameters.
-
Field Details
-
CONFIG_FILE_NAME
Name of the JUnit Platform configuration file: "junit-platform.properties".If a properties file with this name is present in the root of the classpath, it will be used as a source for configuration parameters. If multiple files are present, only the first one detected in the classpath will be used.
- See Also:
-
-
Method Details
-
get
Get the configuration parameter stored under the specifiedkey.If no such key is present in this
ConfigurationParameters, an attempt will be made to look up the value as a JVM system property. If no such system property exists, an attempt will be made to look up the value in the JUnit Platform properties file.- Parameters:
key- the key to look up; nevernullor blank- Returns:
- an
Optionalcontaining the value; nevernullbut potentially empty - See Also:
-
getBoolean
Get the boolean configuration parameter stored under the specifiedkey.If no such key is present in this
ConfigurationParameters, an attempt will be made to look up the value as a JVM system property. If no such system property exists, an attempt will be made to look up the value in the JUnit Platform properties file.- Parameters:
key- the key to look up; nevernullor blank- Returns:
- an
Optionalcontaining the value; nevernullbut potentially empty - See Also:
-
get
@API(status=STABLE, since="1.3") default <T> Optional<T> get(String key, Function<? super String, ? extends @Nullable T> transformer) Get and transform the configuration parameter stored under the specifiedkeyusing the specifiedtransformer.If no such key is present in this
ConfigurationParameters, an attempt will be made to look up the value as a JVM system property. If no such system property exists, an attempt will be made to look up the value in the JUnit Platform properties file.In case the transformer throws an exception, it will be wrapped in a
JUnitExceptionwith a helpful message.- Parameters:
key- the key to look up; nevernullor blanktransformer- the transformer to apply in case a value is found; nevernull- Returns:
- an
Optionalcontaining the value; nevernullbut potentially empty - Since:
- 1.3
- See Also:
-
keySet
-